所有常见电子邮件提供商均阻止 SMTP 访问(CDO / VBScript)
直到最近至少 10 年里, 我已经成功通过 SMTP 发送电子邮件, 通过使用带有 CDO.Message 的简单 VBScript。
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "[email protected]>"
emailObj.To = "[email protected]"
emailObj.Subject = "Test Email"
emailObj.TextBody = "This is a SMTP test email."
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-mail.outlook.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
emailConfig.Fields.Update
emailObj.Send
然而,通过新的测试,我注意到广泛使用的电子邮件提供商(Yahoo、GMail、Hotmail、Mail.com、Yandex)的 SMTP 不再起作用。
对于所有这些,我收到错误消息:
传输无法连接到服务器
为了确保这不是我的问题,我在许多计算机、国家/地区和帐户上进行了测试。我一直在使用官方提供的 SMTP 详细信息和端口 25、465、587 进行测试。其中任何一个都没有运气。
该代码仍然可以成功地与我自己公司的 SMTP 和我们的虚拟主机 SMTP 配合使用。
我们将软件分发给客户,并且不希望他们依赖我们自己的 SMTP 来转发邮件。 他们应该能够在我们的软件上轻松设置他们的个人电子邮件帐户。过去,只需检查他们自己的电子邮件提供商网站并输入提供的 SMTP 详细信息即可。 然而,如今这样的琐碎任务似乎已经变得不可能了。
我在这里遗漏了什么吗?是否仍然可以使用 Visual Basic 脚本和 CDO 来使用广泛使用的电子邮件提供商的 SMTP?
For at least 10 years until recently,
I've been successfully sending emails through SMTP,
by using a simple VBScript with CDO.Message.
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "[email protected]>"
emailObj.To = "[email protected]"
emailObj.Subject = "Test Email"
emailObj.TextBody = "This is a SMTP test email."
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-mail.outlook.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
emailConfig.Fields.Update
emailObj.Send
However with a new test, I notice that no SMTP of widely used email providers works anymore (Yahoo, GMail, Hotmail, Mail.com, Yandex).
For all of them I get the error message:
The transport failed to connect to the server
To be sure it wasn't a problem from my end, I tested from many computers, countries and accounts. I've been testing with the officially provided SMTP details and ports 25, 465, 587. No luck with any of them.
The code still works successfully with the SMTP of my own company and our webhosting SMTP.
We distribute the software to our customers, and we don't want them to be dependent on our own SMTP to relay their mail.
They should be able to easily setup their personal email accounts on our software. It used to be as easy as checking their own email provider website and entering the provided SMTP details.
However, nowadays such a trivial tasks seems to have become impossible.
Am I missing something here, is it still possible to use the SMTP of widely used email providers using Visual Basic Script and CDO?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是常见电子邮件提供商及其方法的列表。
我只是不明白 VBScript 如何在 10 行代码中做到这一点。
Here is a list of common email providers and their methods.
I just don't see how VBScript can do this in 10 lines of code.