OneByte: Sending Emails in Dynamics 365 Finance | OnActuate
 In A-How To

Setting up automatic triggered emails from Microsoft Dynamics 365 Finance (D365) can be used in scenarios where emails are required to be sent, such as when an order is placed, ready for pickup or has been shipped. This cuts down on time spent on writing emails, and allows business processes to move along quicker.

There can be multiple approaches to sending out trigger emails through D365, such as building x++ classes or using the pre-built functionality in D365 to trigger emails from the system templates.

The behavior of the email subsystem is influenced by a combination of administrator configuration, user configuration, user choices, and workflows. Let’s dive into the different email triggers.

Skip to the section you need


Setting email parameters

The behavior of the email subsystem is often determined by prior settings for sending emails, but here’s a general way depicted for a system administrator.

To configure email parameters, go to:

Configuration tab

On the email parameters page, note the following settings on the configuration tab.

Field Description
Batch email provider Specifies which email provider will be used to send emails that are sent by processes in a batch or non-interactive manner. The Exchange provider will use the account associated with the batch process. Other than Exchange there are two more email providers – EML and SMTP.
Attachment size limit Specifies the maximum size of a single email that can be sent via the email subsystem.
Expiration in Days Defines the number of days for which an unsent email status will not be set to “expired”.


  1. The Enabled Interactive Email Providers section gives a list of all the potential email providers that can be used to send emails, for e.g., SMTP uses email client for finance and apps whereas EML uses apps such as Outlook to make .eml files.
  2. The email History section shows the logs of emails sent or failed. By default, the last 30 days of email history are retained. You can adjust this period by changing the value of the number of days.
  3. The Email Throttling section enables non-interactive email providers (such as the batch email provider) to adhere to a per-minute sending limit. This feature can help prevent errors if the system tries to send more emails than the provider allows. Specifically, if an email can’t originally be sent because the per-minute sending limit has been reached, the send attempt for the email will be deferred for up to one minute. After ten deferrals, the system will try to send the email regardless.

SMTP settings tab

On the Email parameters page, the following settings on the SMTP settings tab can be configured.

Server information
Field Description
Outgoing mail server The host name of the desired Simple Mail Transfer Protocol (SMTP) server.

For Microsoft 365 production (including * accounts), use (You can find this setting at at Settings > Mail > POP and IMAP.)

SMTP port number Typically, the port number should be set to 587 for secure transport.
SSL required Determines whether secure encryption transport is used.

Field Description
Authentication required Determines whether a username and password are needed to send emails.
Username and Password If authentication is required, specify the appropriate mail account to send email from. All users need to provide the SMTP account Send as and Send on Behalf of permissions to enable the ability to send SMTP mail.

Test Email

  1. Email provider can be selected to test how the mail is being sent.
  2. Send To and Send As will be required to fill in for test email ids.
  3. Send a test email by clicking test email option.

Email distributor batch process

An email that is sent directly from the server, without user interaction, via SMTP is sent by the email distributor batch process. That batch process must be started to process the email queue. To start the process, open the email distributor batch pane (System administration > Periodic tasks > Email processing > Batch) and turn on Batch processing.

If the Exchange provider is used, then the user account associated with the batch process will be the sender.

User email

The default send from address for each user is pulled from the email field on the Users page (System administration > Users > Users). Administrators can override this send from default if needed using the Sender email field on the Options page.

The Options page can be opened via Settings > User options. The email provider selection section is on the Account tab.

Sending emails in X++

  • The main aim is to demonstrate how we can send emails in X++ using built-in email templates. For demonstration purposes we’ll be using standard SysMailerMessageBuilder class.

Source Code Representation

Note: sendInteractiveMethod can also be used to open an interactive form for the user to edit before sending the email.

  • The runnable class is then attached to an action menu item which is attached to WorkOrderDetails form, which picks up the current Work Order, and sends an email to the specified recipient.

Setting email templates

To select or edit templates, navigate to Organization administration > Setup > Organization email templates.

  1. Enter the email template ID in the email ID field. Enter the email template name in the email description.
  2. Enter the sender’s name in the sender’s name field. This name will appear with the email as a sender.
  3. Enter the sender email in the sender email field. The email for this email template will be sent from this email ID.
  4. Then select the language.
  5. Select the Priority for the email template. (The emails that have the Priority “High” will be sent first and the emails that have priority “Low” will be sent after the emails with High priority).
  6. To setup Subject of the email and Message body of the email, click New button in the Email message content section. Then select the language. You can enter the static text (e.g. [INTERNAL]) and for the dynamic information in the subject, just enter %subject% which will fetch the dynamic information and prepare the dynamic email subject according to the placeholders set.

  1. After entering the subject, click on the Email message button to upload the HTML file that contains the HTML code.
  2. Once the message file is uploaded successfully, the Has body field gets checked which means this email template has the message body to send with email.

Workflow email notification setup

  • After creating the email template, the email distribution batch job must be set up to receive an email from the workflow running in the background. Email distributor batch is the batch job that keeps running on a recurring basis and forwards the email as soon as the task for email sending is created through any source.
  • To run this, navigate to Organization Administration > Periodic tasks > Email processing > Email processing batch.

  • Turn batch processing on and set recurrence to 1 and default setting to minutes.
  • If the Exchange provider is used, then the user account associated with the batch process will be the sender.

  • Now go to User options found by clicking on the Gear icon. Set sender email and Email provider, (in our case SMTP) and set Send notifications as email to true in the workflow tab. These prior settings are needed to ensure the workflow notification email is sent through batch job that is set to send emails for workflows.

Inventory Workflow Creation

Now let us associate the email template with the Inventory transfer journal workflow that will send the email using the associated email template and show the email content as per the email template configuration.

  • Navigate to Inventory management > Setup > Inventory management workflows.

  • Click on new Workflow and select Invent Transfer Workflow.

  • A new workflow window opens.
  • In the basic settings tab, the email template that we created is shown in the Email template for workflow notifications. Select the email template and click the Close button.

  • Double click on the Inventory transfer journal approval element.
  • Select the approval step and click on Basic settings button.
  • And set static text for the message to be displayed to approver as a placeholder as shown.

  • Once the Workflow Message contents are edited, we can close the windows for Workflow basic settings.
  • Click save and close button.
  • Select Activate new version and click the Ok button. This will bring our workflow into an active state.


Submit Workflow with Invent Journal Creation

  • To trigger an email based on the template we created, we must create an Inventory transfer journal and submit it for approval which will send an email to the approver.
  • To do this navigate Inventory management > Journal entries > Items > Transfer.

  • On the Inventory transfer journal page, click the New button.
  • Create the lines and Select the To Site, select To Warehouse and enter the quantity. Click on the workflow button and click on the Submit button.

  • Enter the comments for the approver and click the Submit button which will generate an email and an approval task for the approver.

The batch for the email job will send the workflow to the mail ID specified in the User Options specified for Send to mail ID.


  • As the workflow was set up for self-approval, we can see the workflow request approval message that we set in Workflow set ups.

  • The user can then approve this journal to complete the workflow process.

These were the different ways to set up emails in D365 Finance to streamline business processes and improve efficiencies.


About the expert

Vishakha Shamnani, Technical Consultant, OnActuate

Vishakha is experienced in development and customization for a variety of functionalities in Microsoft Dynamics 365 F&O and customizing Power BI and SSRS reporting and F&O integrations.

Vishakha is currently certified in MB-500: Microsoft Dynamics 365: Finance and Operations Apps Developer and AZ-900: Microsoft Azure Fundamentals.

The “OneByte” blog series are technical how-to articles by OnActuate’s expert consultants covering Microsoft Business Applications (Microsoft Dynamics, Power Platform) and related technologies. Have a topic you’d like to learn more about? Email us at!

Our website uses cookies to personalize and enhance your experience and improve the delivery of information to you. By clicking "Accept", you agree to our use of cookies. Click “Learn more” to read our Privacy Policy