你的位置:ww12345678 的部落格 | AX Helper > 网络文摘 > 类’CDO.Message’的COM对象中的方法’send’返回错误,并且学习了Dynamics Ax 2012 R3。/ Method ‘send’ in COM object of class ‘CDO.Message’ returned error and lesson learned Dynamics Ax 2012 R3.
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.