我正在尝试发送一个联系查询电子邮件从传统的经典asp脚本使用谷歌应用程序帐户作为SMTP服务器。我要测试的代码如下:
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.thedomain.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 ' or 587
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' Google apps mail servers require outgoing authentication. Use a valid email address and password registered with Google Apps.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="info@thedomain.com" 'your Google apps mailbox address
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password" 'Google apps password for that mailbox
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "me@mydomain.net"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "info@thedomain.com"
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing 我尝试过端口号465和587。我尝试过将mail.thedomain.com、smtp.thedomain.com、mail.gmail.com和smtp.gmail.com作为SMTP服务器,但都不起作用。我已经使用脚本中的电子邮件地址和密码登录了Google Apps帐户,因此这些详细信息绝对正确。
我所能得到的只有以下错误:
CDO.Message.1 error '80040213'
The transport failed to connect to the server.
/_test-email.asp, line 46 (第46行显示为ObjSendMail.Send)
有没有人能看到可能出了什么问题?
谢谢大家!
发布于 2012-03-27 01:17:29
我试着使用、Gmail、、smtp服务器,并对您的代码进行了一些修改,它的效果非常好。
只需修改这3个参数,就可以了。
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1发布于 2012-03-12 23:35:03
尝试将smtpusessl设置为1 (真)(我看到您已经将其设置为false)
https://stackoverflow.com/questions/9669644
复制相似问题