我在发送电子邮件时遇到错误:
“错误‘80040211’”
这是我的代码的示例 -
Dim objMessage
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Super Service Comment - "
objMessage.From = "[email protected] /cdn-cgi/l/email-protection"
objMessage.To = "[email protected] /cdn-cgi/l/email-protection;[email protected] /cdn-cgi/l/email-protection"
objMessage.TextBody = "Name...."
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com" 'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected] /cdn-cgi/l/email-protection" 'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "******" 'Your password on the SMTP server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true 'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Update
objMessage.Send
有人遇到过类似的问题吗?
回复晚了,但我想我会分享我在处理同一问题时学到的东西。
从我读到的错误来看80040211
基本上意味着您的 SMTP 服务返回不成功。如果您确定您的服务已启动并且可以远程登录到它,那么您的解决方案可能会通过查看 smtp 服务器设置而不是您的代码来解决。
就我而言,当我尝试附加文件时遇到此错误。结果消息大小的默认限制仅为 2MB。当我在 IIS 的 SMTP 设置中增加此限制时,一切都开始正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)