Description:- In X++ there are many functionality to send mail from X++. Dynamics AX Are very Use full in Entity Relation Ship Programming. Here i Will Create A Job in AX 2012 How to Send Mail From AX in G Mail or Outlook Server. Here you can Add Attachment, or Else you can Put your Friends in CC, Give Subject Name, Send Body Of Code or Content in AX.
if you Want to Save Copy of your Email then Set to Yes otherwise No. or if you Want to Out Mail Server then NoYes::Yes otherwise NoYes::No
static void mail_from_ax1(Args _args) { Description255 recipientEmail; Notes emailBody; Description255 subjectText; Filename fileName; SmmOutlookEmail smmOutlookEmail = new SmmOutlookEmail(); recipientEmail = "umesh.adroja@devitpl.com"; subjectText = "Test Email"; // fileName = @"C:\Users\admin\Desktop\mypic.jpg"; emailBody = "Hi,\nThis is a test email for Dyanmics AX.\nThanks."; if (smmOutlookEmail.createMailItem()) { smmOutlookEmail.addEMailRecipient(recipientEmail); smmOutlookEmail.addSubject(subjectText); //smmOutlookEmail.addFileAsAttachment(fileName); smmOutlookEmail.addBodyText(emailBody); smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::No,false); //smmOutlookEmail.sendEMail(smmSaveCopyOfEMail::Yes,NoYes::Yes); Box::info("Mail Send Successfully !!"); } else { error("Could not communicate with Microsoft Outlook Client."); } }
if you Want to Save Copy of your Email then Set to Yes otherwise No. or if you Want to Out Mail Server then NoYes::Yes otherwise NoYes::No
Thanks for comments.....