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 = "[email protected]"
objMessage.To = "[email protected];[email protected]"
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]" '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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With