通过 Google Apps 使用 CDO 发送邮件会出现传输错误:CDO.Message.1 错误“80040213" [英] Send mail with CDO through Google Apps gives transport error: CDO.Message.1 error '80040213'

查看:27
本文介绍了通过 Google Apps 使用 CDO 发送邮件会出现传输错误:CDO.Message.1 错误“80040213"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Google Apps 帐户作为 SMTP 服务器从旧版经典 asp 脚本发送联系查询电子邮件.我必须测试的代码如下:

I'm trying to send an contact enquiry email from a legacy classic asp script using a Google Apps account as the SMTP server. The code I have to test this is as follows:

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 帐户,因此这些详细信息绝对正确.

I've tried both port numbers 465 and 587. I've tried mail.thedomain.com and smtp.thedomain.com and mail.gmail.com and smtp.gmail.com as the SMTP server, but nothing works. I've logged into the Google Apps account with the email address and password in the script, so those details are definitely correct.

我只能得到以下错误:

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/_test-email.asp, line 46 

(第 46 行是 ObjSendMail.Send)

(line 46 is where it says ObjSendMail.Send)

谁能看出哪里出了问题?

Can anyone see what might be wrong?

谢谢各位!

推荐答案

我尝试使用 Gmail smtp 服务器并对您的代码稍作更改,效果非常棒.

I tried with Gmail smtp server and a little changes to your code and it worked like a charm.

只需修改这 3 个参数即可.

Just modify these 3 parameters and you are good to go.

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

这篇关于通过 Google Apps 使用 CDO 发送邮件会出现传输错误:CDO.Message.1 错误“80040213"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆