ax2009 x++ Error 0x80040211 in RunBaseBatch

1

I want to send email in RunBaseBatch, but I get error 0x80040211 (unknown).
I found in google that means:

The message could not be sent to the SMTP server. The transport error code was %2. The server response was %1

public void SendReport(str email)
{
   SysMailer      sm = new SysMailer();
   ;
   sm.quickSend("axmail@domain.eu", email, "Test", strfmt("body"));
}

This method is called in Run method. And if I copy this source code into job that works. Additionally in Run method I use,

permissionSet = new Set(Types::Class);
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
permissionSet.add(new InteropPermission(InteropKind::ComInterop));
permissionSet.add(new InteropPermission(InteropKind::DllInterop));
CodeAccessPermission::assertMultiple(permissionSet);
axapta
x++
dynamics-ax-2009
asked on Stack Overflow Dec 19, 2016 by neuser • edited Dec 19, 2016 by Jonathan Bravetti

1 Answer

1

Because your email seems to work in a job (client side), your email settings in AX are not the issue. This is most likely an authentication issue.

Take a look at this article, which describes what your are experiencing.

On the client side, your current windows user is used to authenticate with the SMTP server.

In batch, the emails are sent from the AOS. That means that the account used for authentication, is the account under which the AOS service runs.

Your mail server probably doesn't accept connections from everyone.
Take a look here on how this is achieved.

You'll have to allow the user that runs your AOS service, to authenticate to your mail server.

answered on Stack Overflow Jan 27, 2017 by Bjorn Mistiaen • edited Apr 13, 2017 by Community

User contributions licensed under CC BY-SA 3.0