Sending Email with Axapta

Hi all, I’m writing a customization on the HR module to send out emails to other user. And i know that i have to make use of the SysInetMail class. But i’m stuck on how to pass the arguements to the class in order for it to work. I tried to search for an example in Axapta but i can’t seem to find anything. Does anybody know how? Thanks in advance. Regards, Ken

Hi Ken, Have you checked the SysMailer class? Following is the code snippet from the online help system - ---------------------------------------- { SysMailer mailer = new SysMailer(); mailer.body(“This is the body of the mail”); mailer.subject(“The message subject”); mailer.fromAddress(“peter.villadsen@navision.com”); mailer.fromName(“Peter Villadsen”); mailer.tos().add(“pv@dk.damgaard.com”); mailer.tos().add(“peter.villadsen@navision.com”); mailer.attachments().add(“c:\gylle.log”); mailer.sendMail(); pause; } ---------------------------------------- Hope this helps. Harish Mohanbabu

Hi Harish, Thanks for your help. Do i need to declare this SysMailer class first?

Hi Ken, Have you had a look at ‘SysMailer’ class yet? If not, do please have a look under AOT → Classes. For help about this class, just select this class and press F1. Provided that you had a correct setup, you should be able to run the code as a job without any modifications (except for email addresses of course). Please note that SysMailer class use Dundas Mailer COM component. Since this particular component is built within Axapta setup, you don’t have to install anything on top. If you want to integrate MS Outlook, you might want to take a look at ‘Tutorial_Outlook’ form available under AOT → Forms. Hope this helps. Harish Mohanbabu

Thanks Harish, i got it now. Thanks again for your help :slight_smile: