Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sysmailer send email error

329 views
Skip to first unread message

RB

unread,
Feb 9, 2009, 2:09:01 PM2/9/09
to
Hi,

If I run same code without batch processing (as a job), it runs fine.
Somehow when I run it through batch processing (RunBaseBatch class) I am
getting below error:

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

Here is my code to send an email:

static void sendEmail(str _emailTo,str _subject,str _bodyText)
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
str emailFrom = sysuserInfo::find(curUserId(),false).Email;
;
if (_emailTo != "")
{
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
mailer.fromAddress(emailFrom);
mailer.tos().appendAddress(_emailTo);
mailer.subject(_subject);
mailer.htmlBody(_bodyText);
mailer.sendMail();
}
}

Any idea?

Thank you in advance.

Ragin

Axel Kühn

unread,
Feb 9, 2009, 3:03:01 PM2/9/09
to
Hi,
please take a llok at this article:
http://www.archivum.info/microsoft.public.axapta.programming/2008-07/msg00371.html

Please also take a look at:
http://axaptafreak.blogspot.com/2006/12/sending-emails-via-smtp-on-aos-server.html

The same problem was discussed there. Hope this helps you solving your
problem.

If not please take a look at this blogpost:
http://sumit-theaxfactor.spaces.live.com/blog/cns!596957786228C73F!208.entry

This article demonstrates some other techniques to send emails with dynamics
ax.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)

sudhir

unread,
Feb 26, 2009, 7:18:01 AM2/26/09
to
Hi Axel,
I am facing same problem, I have also refered your given link but still
issue is same.
kindly suggest on this.

Thanks
Sudhir

RB

unread,
Feb 26, 2009, 11:56:23 AM2/26/09
to
Hi,

I was just wondering do we need to install any kind of SMTP services on AOS
server? Because when I changed my class to run from client (added 'client'
word in class declaration), I am not getting any error. Basically it suppose
to be run from server.

Ragin

RB

unread,
Mar 13, 2009, 4:30:06 PM3/13/09
to
Issue has been resolved by adding smtp server on AX server and giving
security rights. Our IT network person has resolved this issue.

Sumit Loya

unread,
Mar 16, 2009, 9:58:03 AM3/16/09
to
Hi,

What do you exactly mean by adding smtp server on AX server and what rights
are required to run this feature.

I have tried running the code exclusively from client but am getting this
error.

For me it is not running both on client and server.

Regards,
SKL

0 new messages