Eth*_*len 5 vb.net vbscript smtp cdo.message amazon-ses
是否有一些技巧使VBScript CDO与Amazon SES SMTP协同工作?我没有收到任何错误,但它也没有发送给我我的测试电子邮件.将SSL更改为False确实给我530错误,所以我知道我至少到达了服务器.我究竟做错了什么?
EmailSubject = "Sending Email by CDO"
EmailBody = "This is the body of a message sent via" & vbCRLF & _
"a CDO.Message object using SMTP authentication."
Const EmailFrom = "yyy@xxx.com"
Const EmailFromName = "Me Test"
Const EmailTo = "eee@aaa.com"
Const SMTPServer = "email-smtp.us-east-1.amazonaws.com"
Const SMTPLogon = "xxxxxx"
Const SMTPPassword = "xxxxxxx"
Const SMTPSSL = True
Const SMTPPort = 25
Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking.
Const cdoAnonymous = 0 ' No authentication
Const cdoBasic = 1 ' BASIC clear text authentication
Const cdoNTLM = 2 ' NTLM, Microsoft proprietary authentication
' First, create the message
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = EmailSubject
objMessage.From = """" & EmailFromName & """ <" & EmailFrom & ">"
objMessage.To = EmailTo
objMessage.TextBody = EmailBody
' Second, configure the server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPLogon
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = SMTPSSL
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
' Now send the message!
objMessage.Send
Run Code Online (Sandbox Code Playgroud)
小智 7
CDO不支持TLS,但仅支持SSL.AWS SES将允许您通过TCP端口465使用SSL.尝试在端口25上使用SSL,就像您在发布的脚本中使用SSL一样,应该返回以下错误消息:
CDO.Message.1:传输失去了与服务器的连接.
我不知道你为什么不用这个脚本得到那个错误.我做.尝试将端口更改为465.当我将端口更改为465时,它可以正常工作.
| 归档时间: |
|
| 查看次数: |
6327 次 |
| 最近记录: |