【发布时间】:2012-03-29 00:06:32
【问题描述】:
我正在尝试使用 Google Apps 帐户作为 SMTP 服务器从旧版经典 asp 脚本发送联系查询电子邮件。我必须测试的代码如下:
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)
谁能看出哪里出了问题?
谢谢各位!
【问题讨论】:
-
@Calon 停止以相同方式编辑所有问题...
标签: asp-classic google-apps cdo.message