Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Send Email in X++ using Email Template

(0) ShareShare
ReportReport
Posted on by 10

Once PO is created and confirmed, create invoice, however user will not be able to match a product receipt, when user clicks ok and saves the invoice, the system should send the following information to the user to complete the product receipt. System will send alert via email that user is trying to post invoice without receiving the product receipt and ask the user to receive the product receipt. System will trigger this event when user clicks the ‘Ok’ button, additionally there will be a ‘Send alert for product receipt button’ on the action pane to trigger this event as well.

  • Suggested answer
    Danial47 Profile Picture
    142 on at
    RE: Send Email in X++ using Email Template

        public static void main(Args _args)

        {

            SysMailerMessageBuilder messageBuilder = new SysMailerMessageBuilder();

            Email   toEmail;

            Email   fromEmail;

            try

            {

                FromEmail = “sreddy@xyzcompany.com”;

                toEmail   = “tester@xyzcompany.com”;

                messageBuilder.setBody(“Hello from D365”, false);

                messageBuilder.setSubject(“Email Test from D365”);

                messageBuilder.addTo(toEmail);

                // 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

                messageBuilder.setFrom(fromEmail);

                // Open the generated email in the configured client

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

                SysMailerFactory::sendInteractive(messageBuilder.getMessage());

                // Try using sendNonInteractive method too

            }

            catch (Exception::Error)

            {

                throw error(“@SYS33567”);

            }

    }

  • MuthukumaranAX Profile Picture
    2,901 on at
    RE: Send Email in X++ using Email Template

    can you let us know what is the issue?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,998 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,850 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans