Ir para conteúdo
Fórum Script Brasil
  • 0

Formulário P/ Contato


Gustavo Moraes

Pergunta

É o seguinte, eu tenho um formulario para contato em meu site, porem quando os dados são enviados pro meu email, a acentuação vem toda errada, quase não da pra ler as mensagens, caso o cidadao coloque acento em tudo.

O código é o seguinte:

DIM Mail 
Set Mail = Server.CreateObject("Persits.MailSender") 
Mail.IsHTML = True 
Mail.Host = "" 
Mail.Username = "" 
Mail.Password = "" 
Mail.From = "" 
Mail.FromName = "" 
Mail.AddAddress "" 
Mail.AddCC ""
Mail.Subject = "" 
Mail.Body = Request.Form("motivos") & "<br>" & Request.Form("fromemail") & "<br>" & Request.Form("fromnome") & "<br>" & Request.Form("cidade") & "<br>" & Request.Form("telefone")

On Error Resume Next 
Mail.Send 
If Err <> 0 Then 
   Response.Write "<H2>Ocorreu um erro: " & Err.Description & "</h2>" 
End If 

If Err = 0 Then 
   Response.Write("<H2>Obrigado Sr(a) " & Request.Form("fromnome") & ", seu e-mail foi enviado com sucesso!</H2>") 
   response.Redirect ("mensagem.aspx") 
End If 

Set Mail = Nothing 

%>
Arquivo em HTML
<form method="POST" action="enviar2.asp" name="form" target="_self"> 
<div align="center"> 
<table border="0" class=promocao> 
<tr> 
<td width="23%"><p>Nome:</p></td> 
<td width="74%"><font face="Verdana"><input type="text" name="fromnome" size="30"></font></td> 
</tr> 
<tr> 
<td width="23%"><p>E-Mail:</p></td> 
<td width="74%"><font face="Verdana"><input type="text" name="fromemail" size="30"></font></td> 
</tr> 
<tr> 
<td width="23%"><p>Telefone:</p></td> 
<td width="74%"><font face="Verdana"><input type="text" name="telefone" size="20"></font></td> 
</tr> 
<tr> 
<td width="23%"><p>Cidade:</p></td> 
<td width="74%"><font face="Verdana"><input type="text" name="cidade" size="20"></font></td> 
</tr> 
</table>
<table border=0 width="43%" class=promocao2>
<tr>
<td width="100%"><font face="Verdana"><textarea rows="5" name="motivos" cols="40"></textarea></font></td> 
</tr> 
<tr> 
<td width="100%" align=center><font face="Verdana"><input type="submit" value="ENVIAR" name="botao"></font></td> 
</tr> 
</table> 
</div> 
</form>

Se alguém souber o que pode ser ficarei muito grato!!!

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Rapaz.

Tive esse mesmo problema que você. Coloca esse código aqui:

strbody = replace(strbody, "+"," ")
strbody = replace(strbody, "%26%238364%3B","€")
strbody = replace(strbody, "%A1","¡")
strbody = replace(strbody, "%A3","£")
strbody = replace(strbody, "%A8","¨")
strbody = replace(strbody, "%AA","ª")
strbody = replace(strbody, "%AC","¬")
strbody = replace(strbody, "%B4","´")
strbody = replace(strbody, "%B7","·")
strbody = replace(strbody, "%BA","º")
strbody = replace(strbody, "%BF","¿")
strbody = replace(strbody, "%C3%87","Ç")
strbody = replace(strbody, "%C3%A7","ç")
strbody = replace(strbody, "%0D%0A",vbnewline)
strbody = replace(strbody, "%21","!")
strbody = replace(strbody, "%23","#")
strbody = replace(strbody, "%24","$")
strbody = replace(strbody, "%25","%")
strbody = replace(strbody, "%26","&")
strbody = replace(strbody, "%27","'")
strbody = replace(strbody, "%28","(")
strbody = replace(strbody, "%29",")")
strbody = replace(strbody, "%2B","+")
strbody = replace(strbody, "%2C",",")
strbody = replace(strbody, "%2D","-")
strbody = replace(strbody, "%2E",".")
strbody = replace(strbody, "%2F","/")
strbody = replace(strbody, "%3A",":")
strbody = replace(strbody, "%3B",";")
strbody = replace(strbody, "%3C","<")
strbody = replace(strbody, "%3D","=")
strbody = replace(strbody, "%3E",">")
strbody = replace(strbody, "%3F","?")
strbody = replace(strbody, "%5B","[")
strbody = replace(strbody, "%5C","\")
strbody = replace(strbody, "%5D","]")
strbody = replace(strbody, "%5E","^")
strbody = replace(strbody, "%5F","_")
strbody = replace(strbody, "%60","`")
strbody = replace(strbody, "%7B","{")
strbody = replace(strbody, "%7C","|")
strbody = replace(strbody, "%7D","}")
strbody = replace(strbody, "%7E","~")
strbody = replace(strbody, "%C2","´")
strbody = replace(strbody, "%C3¡","á")
strbody = replace(strbody, "%C3%A9","é")
strbody = replace(strbody, "%C3%AD","í")
strbody = replace(strbody, "%C3%B3","ó")
strbody = replace(strbody, "%C3º","ú")
strbody = replace(strbody, "%C3%A0","à")
strbody = replace(strbody, "%C3¨","è")
strbody = replace(strbody, "%C3¬","ì")
strbody = replace(strbody, "%C3%B2","ò")
strbody = replace(strbody, "%C3%B9","ù")
strbody = replace(strbody, "´%B0","°")
strbody = replace(strbody, "%C3%A2","â")
strbody = replace(strbody, "%C3ª","ê")
strbody = replace(strbody, "%C3´","ô")
strbody = replace(strbody, "%C3£","ã")
strbody = replace(strbody, "%C3%83","Ã")
strbody = replace(strbody, "%C3%B5","õ")
strbody = replace(strbody, "%C3%95","Õ")
strbody = replace(strbody, "%C3%9C","Ü")
strbody = replace(strbody, "%C3%81","Á")
strbody = replace(strbody, "%C3%89","É")
strbody = replace(strbody, "%C3%8D","Í")
strbody = replace(strbody, "%C3%93","Ó")
strbody = replace(strbody, "%C3%9A","Ú")
strbody = replace(strbody, "%C3%80","À")
strbody = replace(strbody, "%C3%88","È")
strbody = replace(strbody, "%C3%8C","Ì")
strbody = replace(strbody, "%C3%92","Ò")
strbody = replace(strbody, "%C3%99","Ù")
strbody = replace(strbody, "%C3%82","Â")
strbody = replace(strbody, "%C3%8A","Ê")
strbody = replace(strbody, "%C3%94","Ô")
Agora no seu Mail.Body voce coloca:
Mail.Body = strbody
Ai você faz a linha strbody.
strBody = Request.Form("motivos") & vbnewline & vbnewline & Request.Form("fromemail") & vbnewline & vbnewline & Request.Form("fromnome") vbnewline & vbnewline & Request.Form("cidade") &vbnewline & vbnewline & Request.Form("telefone") & strBody
NO fim seu código fica assim:
DIM Mail 
Set Mail = Server.CreateObject("Persits.MailSender") 
Mail.IsHTML = True 
Mail.Host = "" 
Mail.Username = "" 
Mail.Password = "" 
Mail.From = "" 
Mail.FromName = "" 
Mail.AddAddress "" 
Mail.AddCC ""
Mail.Subject = "" 
Mail.Body = strbody

strbody = replace(strbody, "+"," ")
strbody = replace(strbody, "%26%238364%3B","€")
strbody = replace(strbody, "%A1","¡")
strbody = replace(strbody, "%A3","£")
strbody = replace(strbody, "%A8","¨")
strbody = replace(strbody, "%AA","ª")
strbody = replace(strbody, "%AC","¬")
strbody = replace(strbody, "%B4","´")
strbody = replace(strbody, "%B7","·")
strbody = replace(strbody, "%BA","º")
strbody = replace(strbody, "%BF","¿")
strbody = replace(strbody, "%C3%87","Ç")
strbody = replace(strbody, "%C3%A7","ç")
strbody = replace(strbody, "%0D%0A",vbnewline)
strbody = replace(strbody, "%21","!")
strbody = replace(strbody, "%23","#")
strbody = replace(strbody, "%24","$")
strbody = replace(strbody, "%25","%")
strbody = replace(strbody, "%26","&")
strbody = replace(strbody, "%27","'")
strbody = replace(strbody, "%28","(")
strbody = replace(strbody, "%29",")")
strbody = replace(strbody, "%2B","+")
strbody = replace(strbody, "%2C",",")
strbody = replace(strbody, "%2D","-")
strbody = replace(strbody, "%2E",".")
strbody = replace(strbody, "%2F","/")
strbody = replace(strbody, "%3A",":")
strbody = replace(strbody, "%3B",";")
strbody = replace(strbody, "%3C","<")
strbody = replace(strbody, "%3D","=")
strbody = replace(strbody, "%3E",">")
strbody = replace(strbody, "%3F","?")
strbody = replace(strbody, "%5B","[")
strbody = replace(strbody, "%5C","\")
strbody = replace(strbody, "%5D","]")
strbody = replace(strbody, "%5E","^")
strbody = replace(strbody, "%5F","_")
strbody = replace(strbody, "%60","`")
strbody = replace(strbody, "%7B","{")
strbody = replace(strbody, "%7C","|")
strbody = replace(strbody, "%7D","}")
strbody = replace(strbody, "%7E","~")
strbody = replace(strbody, "%C2","´")
strbody = replace(strbody, "%C3¡","á")
strbody = replace(strbody, "%C3%A9","é")
strbody = replace(strbody, "%C3%AD","í")
strbody = replace(strbody, "%C3%B3","ó")
strbody = replace(strbody, "%C3º","ú")
strbody = replace(strbody, "%C3%A0","à")
strbody = replace(strbody, "%C3¨","è")
strbody = replace(strbody, "%C3¬","ì")
strbody = replace(strbody, "%C3%B2","ò")
strbody = replace(strbody, "%C3%B9","ù")
strbody = replace(strbody, "´%B0","°")
strbody = replace(strbody, "%C3%A2","â")
strbody = replace(strbody, "%C3ª","ê")
strbody = replace(strbody, "%C3´","ô")
strbody = replace(strbody, "%C3£","ã")
strbody = replace(strbody, "%C3%83","Ã")
strbody = replace(strbody, "%C3%B5","õ")
strbody = replace(strbody, "%C3%95","Õ")
strbody = replace(strbody, "%C3%9C","Ü")
strbody = replace(strbody, "%C3%81","Á")
strbody = replace(strbody, "%C3%89","É")
strbody = replace(strbody, "%C3%8D","Í")
strbody = replace(strbody, "%C3%93","Ó")
strbody = replace(strbody, "%C3%9A","Ú")
strbody = replace(strbody, "%C3%80","À")
strbody = replace(strbody, "%C3%88","È")
strbody = replace(strbody, "%C3%8C","Ì")
strbody = replace(strbody, "%C3%92","Ò")
strbody = replace(strbody, "%C3%99","Ù")
strbody = replace(strbody, "%C3%82","Â")
strbody = replace(strbody, "%C3%8A","Ê")
strbody = replace(strbody, "%C3%94","Ô")

strBody = Request.Form("motivos") & vbnewline & vbnewline & Request.Form("fromemail") & vbnewline & vbnewline & Request.Form("fromnome") vbnewline & vbnewline & Request.Form("cidade") &vbnewline & vbnewline & Request.Form("telefone") & strBody

On Error Resume Next 
Mail.Send 
If Err <> 0 Then 
   Response.Write "<H2>Ocorreu um erro: " & Err.Description & "</h2>" 
End If 

If Err = 0 Then 
   Response.Write("<H2>Obrigado Sr(a) " & Request.Form("fromnome") & ", seu e-mail foi enviado com sucesso!</H2>") 
   response.Redirect ("mensagem.aspx") 
End If 

Set Mail = Nothing 

%>

Testa ai e veja se funciona.

ABS

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,2k
×
×
  • Criar Novo...