Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

gumetis

Form + envio email ?

Recommended Posts

Boa tarde.

 

Galera sou iniciante em ASP, já consegui fazer com que os dados de um Form grave em um DB, mas queria que mandeçe um e-mail, não estou conseguindo com que o codigo funcione, será que alguem poderia me ajudar ????

 

Grato.

 

 

segue codigo abaixo:

 

<!--Variaveis--><%razaosocial = request.form("razao_social")cnpj = request.form("cnpjid")nomefantasia = request.form("nome_fantasia")ie = request.form("ie")cep = request.form("cep")endereco = request.form("endereco")numeroend = request.form("numero_end")complementoend = request.form("complemento_end")bairro = request.form("bairro")cidade = request.form("cidade")estado = request.form("estado")usuario = request.form("usuario")email = request.form("email")nomecontato = request.form("nome_contato")telefone = request.form("telefone")celular = request.form("celular")atacadista = request.form("atacadista")%><%'Conexão DSN'FileName="Connection_ado_conn_string.htm"' Type="ADO"' HTTP="false"' Catalog=""' Schema=""	'MM_cadastro_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("dados/cadastro.mdb")   FileName="Connection_ado_conn_string.htm"' Type="ADO"' HTTP="false"' Catalog=""' Schema=""  MM_cadastro_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("bancogeral.mdb")%><%' *** Edit Operations: declare variablesMM_editAction = CStr(Request("URL"))If (Request.QueryString <> "") Then  MM_editAction = MM_editAction & "?" & Request.QueryStringEnd If' boolean to abort record editMM_abortEdit = false' query string to executeMM_editQuery = ""%><%' *** Insert Record: set variablesIf (CStr(Request("MM_insert")) <> "") Then  MM_editConnection = MM_cadastro_STRING  MM_editTable = "cadastro_cliente"  MM_editRedirectUrl = "index.asp?sobre=cadastroEnviado"  MM_fieldsStr  = "data|value|razao_social|value|nome_fantasia|value|cnpjid|value|ie|value|cep|alue|endereco|value|numero_end|value|complemento_end|value|bairro|value|cidade|vlue|estado|value|usuario|value|email|value|nome_contato|value|telefone|value|cellar|value|atacadista|value|senha|value"  MM_columnsStr = "data|',none,''|razao_social|',none,''|nome_fantasia|',none,''|cnpjid|',none,''|ie|',none,''|cep|',none,''|endereco|',none,''|numero_end|',none,''|complemento_end|',none,''|bairro|',none,''|cidade|',none,''|estado|',none,''|usuario|',none,''|email|',none,''|nome_contato|',none,''|telefone|',none,''|celular|',none,''|atacadista|',none,''|senha|',none,''|"  ' create the MM_fields and MM_columns arrays  MM_fields = Split(MM_fieldsStr, "|")  MM_columns = Split(MM_columnsStr, "|")    ' set the form values  For i = LBound(MM_fields) To UBound(MM_fields) Step 2	MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))  Next  ' append the query string to the redirect URL End If%><%' *** Insert Record: construct a sql insert statement and execute itIf (CStr(Request("MM_insert")) <> "") Then  ' create the sql insert statement  MM_tableValues = ""  MM_dbValues = ""  For i = LBound(MM_fields) To UBound(MM_fields) Step 2	FormVal = MM_fields(i+1)	MM_typeArray = Split(MM_columns(i+1),",")	Delim = MM_typeArray(0)	If (Delim = "none") Then Delim = ""	AltVal = MM_typeArray(1)	If (AltVal = "none") Then AltVal = ""	EmptyVal = MM_typeArray(2)	If (EmptyVal = "none") Then EmptyVal = ""	If (FormVal = "") Then	  FormVal = EmptyVal	Else	  If (AltVal <> "") Then		FormVal = AltVal	  ElseIf (Delim = "'") Then  ' escape quotes		FormVal = "'" & Replace(FormVal,"'","''") & "'"	  Else		FormVal = Delim + FormVal + Delim	  End If	End If	If (i <> LBound(MM_fields)) Then	  MM_tableValues = MM_tableValues & ","	  MM_dbValues = MM_dbValues & ","	End if	MM_tableValues = MM_tableValues & MM_columns(i)	MM_dbValues = MM_dbValues & FormVal  Next  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"  If (Not MM_abortEdit) Then	' execute the insert	Set MM_editCmd = Server.CreateObject("ADODB.Command")	MM_editCmd.ActiveConnection = MM_editConnection	MM_editCmd.CommandText = MM_editQuery	MM_editCmd.Execute	MM_editCmd.ActiveConnection.Close	If (MM_editRedirectUrl <> "") Then	  Response.Redirect(MM_editRedirectUrl)	End If  End IfEnd If%><%set Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.ActiveConnection = MM_cadastro_STRINGRecordset1.Source = "SELECT * FROM cadastro_cliente"Recordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 3Recordset1.Open()Recordset1_numRows = 0%><%Set objmail = Server.CreateObject("CDONTS.NewMail") objmail.from = "Onda-Atacado"objmail.to = "atacado@ondaaquarios.com.br"objmail.subject = "Contato site atacado: "	 mensagem = "<html>"&_				"<font face='verdana' size='4' color='#0000FF'><b>Mensagens Onda Atacado - Cadastro pelo Site</b></font><br><br><br>"&_					"<font face='verdana' size='1' <br><strong>Razão Social: </strong>" & razaosocial &_				"<br><strong>Assunto: </strong>" & ie &_				"<br><strong>Mensagem: </strong>" & cep & "<br><br>"objmail.body = mensagemobjmail.BodyFormat = 0 objmail.MailFormat = 0 objmail.sendSet objmail = nothing%><HTML><HEAD><TITLE>Onda Aquários - Aquarismo em Alto Padrão - Cadastro Clientes</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"></HEAD><BODY BGCOLOR="" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0><body bgcolor="#FFFFFF" text="#000000"><form action="<%=MM_editAction%>" method="post"  name="formulario" onSubmit="return ValidaFormulario()">  <table width="515" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">	<tr>	  <td width="515"> 		  <div align="left"></div></td>	</tr>	<tr>	  <td><div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>CADASTRO</strong></font></div></td>	</tr>	<tr>	  <td> </td>	</tr>	<tr>	  <td><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">		  <tr>			<td width="100%"><div align="left">				<table width="100%" border="0" cellspacing="0" cellpadding="0">				  <tr>					<td><div align="justify"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> Para efetuar o cadastro preencha os campos no formulário abaixo.<br />							  <br />					  Seu cadastro será analisada pelo nosso departamento comercial e retornaremos o mais breve possível com sua senha de acesso a nossa área restrita. <br />					  <br />					  A <strong>Onda Aquários</strong> só atende empresas devidamente cadastradas e atuantes no segemento de aquarismo Pet ou similares.<br />					</font></div></td>				  </tr>				</table>			  <font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000"><br />			</font></div></td>		  </tr>	  </table></td>	</tr>	<tr>	  <td><table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">		  <tr>			<td><div align="center">				<table width="100%" border="0" cellspacing="0" cellpadding="0">				  <tr>					<td><div align="center">						<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">						  <tr>							<td><div align="center">								<table width="515" border="0" align="center" cellpadding="0" cellspacing="0">								  <tr>									<td><div align="left"><font color="#000000">_____________________________________________________________________________________</font></div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000" size="1"><span class="style11"><font color="#0000FF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>Pessoa Jurídica</b></font></span></font></div></td>								  </tr>								  <tr>									<td><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">									  <input name="data" type="hidden" class="Formulario" value="<% =date %> <% = time %>" size="30" />									</font></td>								  </tr>								  <tr>									<td><table width="500" border="0" align="left" cellpadding="0" cellspacing="0">										<tr>										  <td><table width="250" border="0" cellspacing="0" cellpadding="2">											  <tr>												<td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8">Razão 												  Social:</span></font></strong></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													<input name="razao_social" id="razao_social" type="text" class="Formulario" size="30" />												  *</font></div></td>											  </tr>											  <tr>												<td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">CNPJ:</font></strong></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													<input name="cnpjid" type="text" class="Formulario" id="cnpjid" />												  *</font></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">digitar apenas números. </font></div></td>											  </tr>										  </table></td>										  <td><table width="250" border="0" cellspacing="0" cellpadding="2">											  <tr>												<td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8">Nome 												  Fantasia:  </span></font></strong></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													<input name="nome_fantasia" type="text" class="Formulario" size="30" />												  *</font></div></td>											  </tr>											  <tr>												<td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">IE:</font></strong></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													<input name="ie" type="text" class="Formulario" size="15" />												</font></div></td>											  </tr>											  <tr>												<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">digitar apenas números. </font></div></td>											  </tr>										  </table></td>										</tr>									</table></td>								  </tr>								</table>							  <table width="515" border="0" align="center" cellpadding="0" cellspacing="0">								  <tr>									<td><div align="left"> </div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000">_____________________________________________________________________________________</font></div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000" size="1"><span class="style11"><font color="#0000FF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>Endereço</b></font></span></font></div></td>								  </tr>								  <tr>									<td> </td>								  </tr>								  <tr>									<td><div align="left">										<table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td width="127"><table width="101%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">CEP:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left">													  <input name="cep" class="Formulario" size="9" maxlength="9" />												  </div></td>												</tr>											</table></td>											<td width="300"><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Endereço:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="endereco" type="text" class="Formulario" size="39" />												  </font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">*</font></div></td>												</tr>											</table></td>											<td width="73"><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">N.º</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="numero_end" type="text" class="Formulario" size="6" maxlength="6" />												  </font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">*</font></div></td>												</tr>											</table></td>										  </tr>										</table>									  <table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td width="128"><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Complemento:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="complemento_end" type="text" class="Formulario" size="14" />												  </font></div></td>												</tr>											</table></td>											<td width="372"><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Bairro:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="bairro" type="text" class="Formulario" size="39" />												  </font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">*</font></div></td>												</tr>											</table></td>										  </tr>										</table>									  <table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td width="129"><table width="99%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Cidade:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="cidade" type="text" class="Formulario"size="14" />												  </font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">*</font></div></td>												</tr>											</table></td>											<td width="371"><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Estado:</font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><span style="HEIGHT: 14px">													<select name="estado" class="Formulario">													  <option selected="selected" value="0"> </option>													  <option value="AC">Acre</option>													  <option value="AL">Alagoas</option>													  <option value="AP">Amapá</option>													  <option value="AM">Amazonas</option>													  <option value="BA">Bahia</option>													  <option value="CE">Ceará</option>													  <option value="DF">Distrito Federal</option>													  <option value="ES">Espírito Santo</option>													  <option value="GO">Goias</option>													  <option value="MA">Maranhão</option>													  <option value="MT">Mato Grosso</option>													  <option value="MS">Mato Grosso do Sul</option>													  <option value="MG">Minas Gerais</option>													  <option value="PA">Pará</option>													  <option value="PB">Paraíba</option>													  <option value="PR">Paraná</option>													  <option value="PE">Pernambuco</option>													  <option value="PI">Piauí</option>													  <option value="RJ">Rio de Janeiro</option>													  <option value="RN">Rio Grande do Norte</option>													  <option value="RS">Rio Grande do Sul</option>													  <option value="RO">Rondônia</option>													  <option value="RR">Roraima</option>													  <option value="SC">Santa Catarina</option>													  <option value="SP">São Paulo</option>													  <option value="SE">Sergipe</option>													  <option value="TO">Tocantins</option>													</select>												  </span></div></td>												</tr>											</table></td>										  </tr>										</table>									</div></td>								  </tr>								</table>							  <table width="515" border="0" align="center" cellpadding="0" cellspacing="0">								  <tr>									<td><div align="left"> </div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000">_____________________________________________________________________________________</font></div></td>								  </tr>								  <tr>									<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#0000FF"><span class="style3"><span class="style11"><b>Dados 									  para contato</b></span></span></font></div></td>								  </tr>								  <tr>									<td> </td>								  </tr>								  <tr>									<td><div align="left">										<table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td><table width="250" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8">Usuário: </span></font></strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8">(crie login para acesso ao site)</span></font> </div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="usuario" type="text" class="Formulario"size="30" />													*</font></div></td>												</tr>											</table></td>											<td><table width="250" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><strong><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8">E-mail:</span></font></strong></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="email" type="text" class="Formulario" size="30" />													*</font></div></td>												</tr>											</table></td>										  </tr>										</table>									  <table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td><table width="100%" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8"><strong>Nome:</strong></span></font></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="nome_contato" type="text" class="Formulario" size="50" />													  <span class="style8">*</span></font></div></td>												</tr>											</table></td>										  </tr>										</table>									  <table width="500" border="0" cellspacing="0" cellpadding="0">										  <tr>											<td><table width="250" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Telefone:</font></b></div></td>												</tr>												<tr>												  <td><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">													<input name="telefone" class="Formulario" size="8" maxlength="8" onSubmit="return ValidaFormulario();"/>												  </font><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">*</font></div></td>												</tr>											</table></td>											<td><table width="250" border="0" cellspacing="0" cellpadding="2">												<tr>												  <td><div align="left"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Celular:</font></b></div></td>												</tr>												<tr>												  <td><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">													<input name="celular" class="Formulario" size="8" maxlength="8" />												  </font></div></td>												</tr>											</table></td>										  </tr>										</table>									</div></td>								  </tr>								</table>							  <table width="515" border="0" align="center" cellpadding="0" cellspacing="0">								  <tr>									<td><div align="left"> </div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000">_____________________________________________________________________________________</font></div></td>								  </tr>								  <tr>									<td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#0000FF"><b>A sua empresa  compra com algum outro atacadista? Qual?</b></font></div></td>								  </tr>								  <tr>									<td> </td>								  </tr>								  <tr>									<td><div align="center">										<table width="500" border="0" align="left" cellpadding="0" cellspacing="0">										  <tr>											<td><table width="77%" border="0" align="left" cellpadding="2" cellspacing="0">												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000"><span class="style8"><strong>Nome:</strong></span></font></div></td>												</tr>												<tr>												  <td><div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">													  <input name="atacadista" type="text" class="Formulario" size="50" />													  <span class="style8">*</span></font></div></td>												</tr>											</table></td>										  </tr>										</table>									</div></td>								  </tr>								  <tr>									<td><div align="left"> </div></td>								  </tr>								  <tr>									<td><div align="left"><font color="#000000">_____________________________________________________________________________________</font></div></td>								  </tr>								  <tr>									<td> </td>								  </tr>								  <tr>									<td><table width="77%" border="0" align="left" cellpadding="2" cellspacing="0">										<tr>										  <td><div align="center">											  <input type="hidden" name="MM_insert" value="true">											  <input name="submit" type="submit" value="Enviar"> 										  </div></td>										</tr>									</table></td>								  </tr>								</table>							</div></td>						  </tr>						</table>					  <br />					</div></td>				  </tr>				</table>			</div></td>		  </tr>	  </table></td>	</tr>	<tr>	  <td> </td>	</tr>  </table></form></body></html><%Recordset1.Close()%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

logo abaixo dessa linha

MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

coloque o código de envio de e-mail

Compartilhar este post


Link para o post
Compartilhar em outros sites

logo abaixo dessa linha

MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
coloque o código de envio de e-mail
Ted k' CARA FUNCIONOU BELEZA, MUITO OBRIGADO MESMO, QUALQUER COISA QUE PRECISAR SOBRE ARTE GRAFICA FICAREI GRATO EM TÉ AJUDAR, A UNICA COISA QUE MANDO RS..RS..você TERIA ALGUMA APOSTILA PARA INICIANTES BOA AI ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.