IIS 7 and Above
CDOSYS mail failing error '8004020e' when sending to exernal addresse...
Last post Mar 05, 2019 07:43 AM by Chenks76
Feb 26, 2019 02:38 PM|Chenks76|LINK
windows server 2008 / IIS 7
so i've been using CDOSYS mymail functions for a while along with our office365 managed external mail provider.
it works and can send to any email address as long its within the same "email domain"..
however i have since found out that it fails when trying to send to any external email address, with the usual #error '8004020e' error.
what i can't understand is why it fails here, but when we use the exact same account/authentication details on a different system that auomates reports for us (jeffnet), then it is able to send to external address just fine.
so i can only assume it is either an IIS config issue or a code issue.
the code i am using is
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 20
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "email@example.com"
myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password123"
jeffnet uses just the following details
SMTP server : smtp.office365.com
SMTP port : 587
mail account name : firstname.lastname@example.org
authentication id : email@example.com
authentication password : password123
so can anyone help with what the issue might be?
i can only assume it's not an office365 issue, otherwise jeffnet would also fail to send to external addresses.
Feb 27, 2019 07:44 AM|Jalpa Panchal|LINK
This error is caused by the email components not being able to send email.
The causes of this error are:
Feb 27, 2019 07:53 AM|Chenks76|LINK
Thanks Jalps, but did you read what i posted?
the email componenta ARE able to send email, as long as they are internal email addresses, it only fails when sending to external.
1)the SMTP server/post is correct, as shown when using another application with the exact same details
2)login/password is correct, as shown when using another application with the exact same details
3)access to the mail server is fine, again it can send emails providing it is "internal" emails
4) the FROM field is valid
5) i don't follow what you're saying in this part. the email is external hosted by office365, the webserver is internal on our own network. as i said though it can send emails providing they are internal, it can only not send to external addresses.
Feb 27, 2019 08:14 AM|Chenks76|LINK
UPDATE - i've done some further testing and it appears that it must be a server config issue.
if i have the exact same code on an old Windows 2003 Server (on the same network) then it works fine for both internal and external emails.
so this shows that the ASP code and the SMTP server/login details are all correct.
it only fails when running on the Windows 2008 server.
so what might be the issue?
Mar 01, 2019 11:34 AM|Chenks76|LINK
Mar 05, 2019 07:17 AM|Jalpa Panchal|LINK
Did you follow same steps to configure server? could please describe the steps which you followed?
Mar 05, 2019 07:43 AM|Chenks76|LINK
they are different servers, so following steps wouldn't be appropriate
the original server is windows server 2003, the server now being used is window server 2008.
the setup processes are different.
however both are running IIS and both are operating correctly as web servers.
the server 2008 can clearly communicate with the external office365 mail server (otherwise it wouldn't be able to send emails to any addresses on @myoffice365email.com, it only fails when trying to send to any other email, eg @gmail.com)