Sending mail from X++

In order to send the mail from AX, firstly email configuration should be set up.

System administration > Setup > System >E-mail parameters





Once this template filled up, writing query in job or based upon requirement the below code will send the mail :


static void SendQuickMail(Args _args)
{

str FromAddress = “vishalece2006@gmail.com”;
str Subject = “MailFromX++″;
str Body = “Hi”;
str FileToAttach = “D:\\AXFile.pdf”;
SysMailer mailer = new SysMailer();
;
mailer.ccs().appendAddress(“vishalece2006@gmail.com;abc@gmail.com”);
mailer.quickSend(fromaddress,” vishalece2006@gmail.com”,subject,body,”",FileToAttach);
}

Note: Given Path is in AX2012


4 comments:

Powered by Blogger.