Sending Email using X++ Code (AX7 /D365 for Operations)


I was just researching on the emailing capabilities in D365 and found that SysINetMail, SysMailer and some of the smmOutlook classes are deprecated because these classes used predominantly client-side technologies that are no longer available

Below is the quick code snippet that can be used in D365 to send emails. Please note, this is just a untested sample code, with out any setups configured. please ensure all setups are done and improvise the code accordingly.

SysMailerFactory class internally used SysImailer* classes to send emails.

class SRSendEmail_D365


    public static void main(Args _args)


        SysMailerMessageBuilder messageBuilder = new SysMailerMessageBuilder();

        Email   toEmail;

        Email   fromEmail;




            FromEmail = "";

            toEmail   = "";


            messageBuilder.setBody("Hello from D365", false);

            messageBuilder.setSubject("Email Test from D365");


            // Note: not calling setFrom() defaults to the current user for SMTP client, whereas

            // when sent to Outlook any setFrom() value will be ignored since profiles on the client are used



            // Open the generated email in the configured client

            // Sends a message interactively, allowing the user to view and modify the message before


            // Try using sendNonInteractive method too


        catch (Exception::Error)


            throw error("@SYS33567");





Happy Dax6ng,



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: