发送邮件通过谷歌Apps的CDO提供传输错误:CDO.Message.1错误'80040213' [英] Send mail with CDO through Google Apps gives transport error: CDO.Message.1 error '80040213'

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

问题描述

我想从使用谷歌Apps帐户的SMTP服务器的传统经典的ASP脚本发送询盘联系电子邮件。在code一定要考,这是如下:

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服务器,但没有任何工程。我登录到谷歌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.

我能拿到虽然是以下错误:

All I can get though is the following error:

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服务器和你的code一点点的变化和它的工作就像一个魅力。

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

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

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