vb.net 运行时错误 - 2147220973 (80040213) 从 vb6 发送邮件时,传输无法连接到服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31069908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run time error - 2147220973 (80040213) The transport failed to connect to the server while sending mail from vb6
提问by Priti
I am making one application in vb6 which sends mail from an application, it gives me
我正在 vb6 中制作一个应用程序,它从一个应用程序发送邮件,它给了我
Run time error - 2147220973 (80040213) The transport failed to contact to the server
运行时错误 - 2147220973 (80040213) 传输未能联系到服务器
, I did all the given solution gives before
,我之前做了所有给定的解决方案
Please help if any one knows solution.
如果有人知道解决方案,请帮助。
Code: code:
代码: 代码:
{
mStrProcName = "MonthlyXlMail_EmployeePerformance"
sFilePath = (App.Path & "\TimeTaken.xls")
iConf.Load -1
Set Flds = iConf.Fields
Set lobj_cdomsg = New CDO.Message
lobj_cdomsg.Configuration.Fields(cdoSMTPServer) = Trim(rsMail!ServerUrl)
lobj_cdomsg.Configuration.Fields(cdoSMTPServerPort) = CInt(Trim(rsMail!Port))
lobj_cdomsg.Configuration.Fields(cdoSMTPUseSSL) = IIf(rsMail!ReqSSL = "Y", True, False)
lobj_cdomsg.Configuration.Fields(cdoSMTPAuthenticate) = cdoBasic
lobj_cdomsg.Configuration.Fields(cdoSendUserName) = Trim(rsMail!EMailID)
lobj_cdomsg.Configuration.Fields(cdoSendPassword) = Trim(rsMail!EmailPassword)
lobj_cdomsg.Configuration.Fields(cdoSMTPConnectionTimeout) = 30
lobj_cdomsg.Configuration.Fields(cdoSendUsingMethod) = cdoSendUsingPort
lobj_cdomsg.Configuration.Fields.Update
lobj_cdomsg.To = Trim(strMail)
lobj_cdomsg.From = Trim(rsMail!EMailID)
lobj_cdomsg.Subject = IIf(Len(Trim(txtsubject.Text)) = 0, "Performance Report", Trim(txtsubject.Text))
lobj_cdomsg.TextBody = IIf(Len(Trim(txtDescription.Text)) = 0, "Find Attachment", Trim(txtDescription.Text))
'lobj_cdomsg.HTMLBody = strMsg
lobj_cdomsg.AddAttachment (sFilePath)
lobj_cdomsg.Send
}
回答by Colin Raaijmakers
Are you using Gmail with Two factor auth? This also prevents using smtp with basic authentication.
您是否使用具有双重身份验证的 Gmail?这也可以防止将 smtp 与基本身份验证一起使用。
Create a custom app in you Gmail security settings to add a new password for your messaging application.
在您的 Gmail 安全设置中创建自定义应用程序,为您的消息传递应用程序添加新密码。
1. Login into your Gmail account
2. Goto https://security.google.com/settings/security/apppasswords
3. Choose 'Custom' app.
4. Typ 'Gmail Smtp', or something
5. Click 'Generate'
6. It will give you a password token.
Use this token as your password in your messaging application instead of your own password.
将此令牌用作您的消息传递应用程序中的密码,而不是您自己的密码。

