5
I am trying to send a form to an email using CDONT, but the charset is coming incorrectly and is not showing the accented characters correctly.
<%
Response.ContentType = "text/html"
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
Response.CharSet = "UTF-8"
mail_to = "[email protected]"
Dim f, emsg, mail_to, r, o, c, other
emsg = "<!DOCTYPE html><html lang=""pt-br""><head><meta charset=""UTF-8"" /></head><body>" & _
"<strong>Solicitante: " & Request("txtSol") & vbCrLF & _
"Data da solicitação:</strong> " & Request("txDatatSol") & vbCrLF & _
"Setor: " & Request("cboSetor") & vbCrLF & _
"Descrição do produto/serviço: " & vbCrLF & Request("txtProdServ") & vbCrLF & _
"Justificativa da solicitação: " & vbCrLF & Request("txtJust") & vbCrLF & _
"Valor médio: " & Request("txValor") & vbCrLF & _
"Prazo limite: " & Request("txDatatLim") & vbCrLF & _
"Especificações técnicas do produto/serviço e requisitos da qualidade exigidos: " & vbCrLF & Request("txtEspcTec") & vbCrLF & _
"Produto Crítico? " & Request("rdoCritico") & vbCrLF & _
"Possíveis fornecedores: " & vbCrLF & Request("txtFornc") & vbCrLF & _
"Fornecedor exclusivo? " & Request("rdoExclusivo") & vbCrLF & _
"Você confirma o envio do parecer técnico? " & Request("rdoParecer") & _
"</body> </html>"
For Each f In Request.Form
If mid(f,1,1)<>"S" = True Then
emsg = emsg & f & " = " & Trim(Request.Form(f))
End If
Next
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = Request("txtSol")
objNewMail.Subject = "Solicitação de compra"
objNewMail.To = mail_to
objNewMail.BodyFormat=0
objNewMail.MailFormat=0
objNewMail.Body = emsg
objNewMail.Send
Set objNewMail = Nothing
response.redirect "home.asp?status=enviado"
%>
Is the source file encoded in UTF-8? You can check by opening it in Notepad++ and going to Format. Even, you can convert to UTF-8. As your email is getting data from another page, make sure there is also in UTF-8. And send the Form using
POST
.– humungs
Yes, the files are in UTF-8. I’ve tested so much through the
POST
how muchGET
.– Matt S