Art*_*ion 1 email utf-8 cdo.message asp-classic iis-8.5
我在IIS 8.5和Windows 8.1中使用CDO在Classic ASP中发送电子邮件时出现问题,拉丁字符会出现问题,例如ñáéíóúü等.例如,如果我把ñ放在主题和/或身体中我得到Ã ±.
这些是我的代码:
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "the-pwd-123"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.BodyPart.Charset = "utf-8"
'.BodyPart.Charset = "unicode-1-1-utf-8"
.To = "<email@gmail.com>"
.From = "<email2@gmail.com>"
.Subject = "Envio de contraseña"
.TextBody = "This email has a ñ to see how it looks when sending email through CDO"
.Send
End With
Run Code Online (Sandbox Code Playgroud)
电子邮件的配置是UTF8,那么问题出在哪里?,我该如何解决?
首先,尝试将其添加到页面顶部
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>.
此外,由于您的ñ是硬编码,请使用UTF-8编码保存文件.如果您在记事本(或VS以外的任何编辑器)中打开它并选择另存为,您应该会在出现的对话框中看到编码下拉列表.
有关详细信息,请参阅此 http://www.hanselman.com/blog/InternationalizationAndClassicASP.aspx
| 归档时间: |
|
| 查看次数: |
1105 次 |
| 最近记录: |