我正在尝试使用 Amazon SES 发送测试电子邮件,但没有运气:
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Const cdoSendUsingPort = 2
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "email-smtp.us-east-1.amazonaws.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "ABCDE"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "12345"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "bar@foo.com"
.From = "foo@bar.com"
.Subject = "test"
.TextBody = "body"
.Send
End With
response.write("sent")
日志记录信息似乎表明身份验证存在问题。不幸的是,我并不精通,也不明白我可能做错了什么。
Response: 250-email-smtp.amazonaws.com
Response: 250-8BITMIME
Response: 250-SIZE 10485760
Response: 250-STARTTLS
Response: 250-AUTH PLAIN LOGIN
Response: 250 Ok
Command: AUTH LOGIN
Response: 530 Must issue a STARTTLS command first
Command: MAIL FROM: [address in verified senders list]
Response: 530 Authentication required
Command: Quit
解决方案如下
:
响应:530 必须首先发出 STARTTLS 命令
在进行身份验证之前,您需要启用安全连接。您已经通过配置启用了 SSL:
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
将其更改为:
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
(请注意从True
到1
的变化)