Sending Outlook mail through X++

Hi all,

i am using this code to send oulook mail in ax2012 & ax2009.

SysINetMail mail=new SysINetMail();
;
mail.sendMailAttach(’‘to user id’,“cc user Id”,“Subject”,“This text Body of the mail”,false,@‘D:\file.pdf’);

my outlook version is 2010

In ax2012, it is working fine. But, in ax2009 it give’s an error message.

Mail error: Unknown MAPI error

Please give me some suggestion to resolve this issue.

Hi Satya,

Instead you can use the below peice of code:

str ToAddress = “aa@a.com”;

str FromAddress = “bb@b.com”;

str Subject = “test”;

str Body ;

//str FileToAttach = ‘C:\users\lakshmi.s\Desktop\1.txt’;

SysMailer mailer = new SysMailer();

;

Body = “Body of the email”;

mailer.quickSend(fromaddress,toaddress,subject,body,toaddress);

– > This quick send will even contain the attachment.

Hi vishal,

Thanks for your replay, the code which you sent is for out going mails like gmail,yahoo. But, i am looking for local MS Outlook mails. Please suggest me, if you have any solution.