Very interesting scenario we faced in one customization. Requirement was very simple and developer used very code to send Email.
Usually testing will be done on dev box which has both AOS and client installed on same machine. No error occurred and code shipped to production. But when we deploy the code on production server and test the email sent functionality we got following error.
Method ‘send’ in COM object of class ‘CDO.Message’ returned error code 0x8004020F (<unknown>) which means: <unknown>.
After trouble shoot we found that when we run the AX client from another machine pointing to AOS this error occurred. There is some network security issue which did not access rights to SMTP server while running code from Client.
So what is solution. Then we explore how Ax send email. What is out of the box solution.
We found that in out of the box functionality, AX did not send email immediately, Instead, they stored required information in some tables and then Batch sent emails on Server.
So We changed our design and new code just inject information into out of the box tables and emails goes with out of box batch job. Only attachment part was little bit tricky.
Recommendation and lesson learned that, instead calling Smtp server directly on code, we have to use out of the box functionality and just integrate it.