简体   繁体   中英

VBScript Error '80040211' when sending emails

I have an error when sending emails: "error '80040211' "

Here's an example of my code-

Dim objMessage
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Super Service Comment - "

objMessage.From = "someone@s.com"
objMessage.To = "someone1@s.zendesk.com;someone2@s.com"
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") = "someone4@s.com" '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 

Someone worked with a similar problem?

Late reply, but figured I'd share what I've learned in dealing with the same issue.

From what I've read error 80040211 basically means your SMTP service is returning not successful. If you're sure your service is up and you can telnet into it then your solution will probably be solved by looking at the smtp server settings, not your code.

In my case I was getting this error when I was trying to attach a file. Turns out the default limit for message size is only 2MB. When I increased this limit in IIS's SMTP setup everything started working just fine.

Late reply as well, but the information here may be valuable to someone. As it turns out, in my case, the generic error 80040211 was caused by the line length exceeding the allowable limit by the server. In my case, adding vbcrlf as a carriage return/line feed to the body of the email on occasion solved the problem.

I had the same error, so I've configured my Gmail settings, activeted two steps authentication and created a new app password, just for CDOsys. And it works like a charm.

An even later answer (in case of use to others). We got this error when we had no connector configured on our Exchange box.

我将添加另一个原因:登录 SMTP 服务器时用户名或密码不正确。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM