首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Google Apps使用CDO发送邮件时出现传输错误: CDO.Message.1错误'80040213‘

通过Google Apps使用CDO发送邮件时出现传输错误: CDO.Message.1错误'80040213‘
EN

Stack Overflow用户
提问于 2012-03-12 23:11:23
回答 2查看 12.6K关注 0票数 1

我正在尝试发送一个联系查询电子邮件从传统的经典asp脚本使用谷歌应用程序帐户作为SMTP服务器。我要测试的代码如下:

代码语言:javascript
复制
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帐户,因此这些详细信息绝对正确。

我所能得到的只有以下错误:

代码语言:javascript
复制
CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/_test-email.asp, line 46 

(第46行显示为ObjSendMail.Send)

有没有人能看到可能出了什么问题?

谢谢大家!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-27 01:17:29

我试着使用、Gmail、、smtp服务器,并对您的代码进行了一些修改,它的效果非常好。

只需修改这3个参数,就可以了。

代码语言:javascript
复制
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
票数 3
EN

Stack Overflow用户

发布于 2012-03-12 23:35:03

尝试将smtpusessl设置为1 (真)(我看到您已经将其设置为false)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9669644

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档