问题
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?
回答1:
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.
回答2:
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.
回答3:
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.
回答4:
An even later answer (in case of use to others). We got this error when we had no connector configured on our Exchange box.
来源:https://stackoverflow.com/questions/23224631/vbscript-error-80040211-when-sending-emails