web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Method 'send' in COM object of class 'CDO.Message' returned error code 0x8004020F (<unknown>) which means: <unknown>.

(0) ShareShare
ReportReport
Posted on by 505

Hi All,

I am getting this error

Method 'send' in COM object of class 'CDO.Message' returned error code 0x8004020F (<unknown>) which means: <unknown>.

When I try to send email from job.

SysMailer mailer = new SysMailer();


mailer.quickSend(payables@testDomain.ae,

  "abc@testdomain2.com",

  "This is test email. Please ignore",

  "body",

  "",

  @\\ServerName\Vendor\test.pdf);

Note --> From email address and To email address are in different domain. (error occurred when these two domain are different, works fine when domain are same)

In PROD environment there are two AOS server --> AOS1, AOS2

Strange things happen when above piece of code works fine in AOS2 and gives error in AOS1.

Any one can tell me cause of this error and how can I resolve it.

Thanks in advance

 

 

SysMailer mailer = new SysMailer();

mailer.quickSend(payables@testDomain.ae,

"abc@testdomain2.com",

"This is test email. Please ignore",

"body",

"",

@\\ServerName\Vendor\test.pdf);

*This post is locked for comments

I have the same question (0)
  • Ishu.caddengg@hotmail.com Profile Picture
    505 on at

    Just now I noticed that

    When I connect AOS1 through server name Server1, above code gives error.

    When I connect AOS1 through server name SERVER2, it works fine.

    Hence it seems like server specific setting. Any idea which setting plays this role?

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    On our mail server we can set up which servers are allowed to generate e-mails from. Maybe you have the same access restrictions defined and your system engineers needs to add the rights for both computers.

    Also check if both computers or your AX AOS account is allowed to explicitly connect/access to the shared folder from where you are attaching the file.

    Also this could be a CIL issue if you change code on your Production instances directly which you should really not do. Try restarting both AOS instances.

  • Ishu.caddengg@hotmail.com Profile Picture
    505 on at

    Thanks for reply Vilmos.

    Other user from same server and AOS are able to send email.

    so it couldnt be CIL/attachement issue.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Try to refresh your Test AX AOS instance with an SQL backup of Production, and see after the refresh whether it is working there, or not with the account you have trouble with. If you get the error message, now you are in a better position, since you may attach with Visual Studio to the AX AOS process in Test, and debug what the error message is, and also get the inner exception, which might tell what the exact error is.

  • Ishu.caddengg@hotmail.com Profile Picture
    505 on at

    I got alternative solution of this.

    I tried  running same piece of code on Server and it is working fine. except one thing that attachment is not getting attached in email.

    Any idea why same code is running in server not in client?

    what is the problem with attachment?

    I am attaching piece of code for your reference

       SysMailer               mailer;

       InteropPermission       interopPermission;

       str                     filePath;

       FileIOPermission        fioPermission;

       filePath = @"\\Server\VendRem\test.pdf";

       fioPermission = new FileIOPermission(filePath ,"RW");

       fioPermission.assert();

       interopPermission = new InteropPermission(InteropKind::ComInterop);

       interopPermission.assert();

       mailer = new SysMailer();

      // mailer.attachments().add(filePath);

       mailer.quickSend("senderemail@testdomain.ae",

                        "toemail@domain.com",

                        "This is test email. Please ignore",

                        "body",

                        "",

                        filePath);

       CodeAccessPermission::revertAssert();

  • Vilmos Kintera Profile Picture
    46,149 on at

    If you use server path on client end, does the user account have access to the file share you are using on the server?

  • Ishu.caddengg@hotmail.com Profile Picture
    505 on at

    yes user account do have access to filepath

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Try to debug it in Visual Studio and see what is the inner exception.

  • VermaMC Profile Picture
    471 on at

    Hi,

    I have performed all the above steps, But, still I am getting the below error.

    "Method 'send' in COM object of class 'CDO.Message' returned error code 0x80040211 (<unknown>) which means: <unknown>."

    My email parameters are working with Standard SSRS reports. So, no problem with email parameters.

    try CIL, restarted AOS.

    no Luck.

    Please help me.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans