How i can send email directly from x++ code.
thanks
How i can send email directly from x++ code.
thanks
Hi Marco,
This was discussed many times here. I did a quick search for you and found these -
http://dynamicsuser.net/forums/p/24812/139303.aspx#139303
http://dynamicsuser.net/forums/p/48464/249962.aspx#249962
If the above doesn’t help, please search here and you will find them.
Hi,
have a look at the following links:
http://dax-ideas.blogspot.fr/2010/04/emailing-techniques-in-dynamics-ax-or.html
or
hope it helps
Regards,
Thomas
static void emailThruSysMailer(Args _args)
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
;
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(‘AX@biolchim.it’);
mailer.tos().appendAddress(‘dellavalle@biolchim.it’);
mailer.htmlBody(‘AZZZ’);
mailer.subject(‘Comunicazione AX’);
mailer.sendMail();
}
I have used this code and work perfect, now how can i Add an attachment using SysMailer();???
is possible to manage also the header of the email because i need to put this “Disposition-Notification-To: My mail@gmail.com”.
Thanks
This is from AX 2012.
///////////////////////////////////////////////////
str filePathName;
…
filePathName = + ;
…
mailer.attachments().add(filePathName);
///////////////////////////////////////////////////
Hope this helps!
Do you mean the subject?
//////////////////////////////////////////////
mailer.subject(‘Disposition-Notification-To: My mail@gmail.com’);
//////////////////////////////////////////////
Ok perfect the attachment work, but the disposition notification in the subject doesnt work.
I need to receive a confirmation that the email was read from the recipient.
Have a look at ‘quickSend’ method which among other things exposes following properties -