How To Configure Email In D365

Share this:

There are several different ways to configure email in D365. Microsoft Graph is now the recommended email provider, replacing the deprecated Exchange email provider. Additionally, you can set up a connection to an SMTP email server. Lastly, the system can generate an .eml file that the user can download. Then the user can use an email app, such as Outlook, to send the email themselves. In this article, explore and understand each option. Then, learn how to configure a Gmail SMTP server for testing.

Microsoft Documentation

First, and foremost, to configure email in D365, I recommend reviewing the Microsoft documentation for the latest information.

While many setup steps with the system do not change frequently, some are more likely to. It is important that any process that involves security or sending information outside D365 use the most up to date processes.

Email Parameters

To configure email in D365, navigate to System administration>Setup>Email parameters, or search for ‘email parameters‘ in the search bar.

This form is used to set up the email configuration. Additionally, after setting up the email server, this form includes functions to test the email server connection and send a test email. Finally, it has several links to view the email history and batch jobs for sending emails. See the following sections for more details.

Configuration

On the ‘Configuration‘ tab, first, use the Arrows to specify which of the available email providers are enabled. Then, set the ‘Batch email provider’ field to the email provider that the system should use to send emails that are sent by processes running in batch.

Second, set the ‘Attachment size limit (MB)‘ to the maximum size that a single email can be sent.

Third, set the ‘Email expiration in days‘. This specifies the number of days before the status of an unsent message is set to Expired. A value of 0 actually means that the default period of 30 days will be used.

Fourth, set the ‘Number of days to retail email history’. Again, if set to 0, the default of 30 days of email history will be retained. This setting helps control the amount of data used while also acts as a log for review.

Click the ‘View email history’ link to view emails in the ‘Email history‘ form.

Lastly, the ‘Email throttling‘ section helps control how many emails are sent by the batch servers, helping prevent errors if the provider only allows so many per minute. The email providers often have their own throttling mechanisms so it is recommend you do not set these fields.

SMTP settings

To configure email in D365 using an SMTP server, fill in the fields on the ‘SMTP settings‘ tab of the Email parameters‘ form.

First, if you are using a Microsoft 365 Production server, set the ‘Outgoing mail server‘ to ‘smtp.office365.com’. However, this option can require additional security steps in the Azure Portal to allow. Therefore, I chose to use a Gmail server so that I could more easily test this functionality. When using Gmail, set the ‘Outgoing mail server‘ to ‘smtp.gmail.com

Second, typically set the ‘SMTP port number‘ to 587 for secure transport.

Third, set the ‘SSL/TLS required‘ field to Yes.

Fourth, set the ‘Authentication required‘ field to Yes.

Fifth, set the ‘User name’ and ‘Password’ using your email credentials. In my case, I specified my Gmail email address. However, in the case of a Gmail SMTP server, you must create and use an App Password instead of your typical password.

Create A Gmail App Password

Before entering in the ‘Password‘ field on the ‘SMTP settings‘ tab, you need to set up an App Password when using a Gmail SMTP server.

First, in a browser, navigate to https://www.google.com.

Second, click on the ‘Sign in’ button in the top right corner of the browser, and sign in using your Gmail account email and password. If you don’t already have a Gmail account, follow these instructions to create a Gmail account.

Third, click on your Profile icon in the top right corner of the browser, then select ‘Manage your Google Account

Fourth, select ‘Security & sign-in‘, then search for ‘App passwords‘ and select the ‘App passwords‘ result.

Fifth, in the form that opens, enter a name for the App Password. For example, I entered ‘SMTP D365‘. Then, click the ‘Create‘ button.

Sixth, the system will generate an ‘App Password‘ and display it in a dialog.

Finally, to configure email in D365, copy and paste this password into the ‘Password‘ field on the ‘SMTP settings‘ tab in D365.

If you receive an error message after leaving the ‘User name’ or ‘Password’ field, ensure you have entered the correct information and try again.

Test connection

After all that, we can now test the SMTP server connection. Click on the ‘Test connection‘ link.

If the settings to configure a D365 email are correct, you should see a message confirming the connection is successful.

Test email

Finally, we can test sending an email to confirm the setup works. The easiest way to do that is to use the ‘Test email’ functionality.

First, navigate to the ‘Test email’ tab on the System administration>Setup>Email parameters form.

Second, set the ‘Email provider‘ using the drop-down. For this example, I select ‘SMTP‘.

Third, enter in an email address to send the test email to. In this case, I entered in my own Gmail email address.

Third, the ‘Will send as‘ field is a disabled field that shows the ‘From’ email address that will be used.

Fourth, click the ‘Send test email‘ link to send a test email to the specified email address. If success, a dialog box will show a message saying the Test email was sent.

Finally, view the email inbox of the email address where the test email was sent. Confirm, the email was received.

Sender Email

To see where the ‘Sender email’ is set, go to the Gear icon in the top right bar of D365, then select User Options.

Then, go to the ‘Account’ tab and view the ‘Sender email’ address associated with this user.

See this Microsoft documentation for further information.

View Email History

After the system has sent emails, they can be reviewed in the ’email history’ form.

Navigate to System administration>Setup>Email>Email history. Alternatively, back on the ‘Test email’ tab of the ‘Email parameters’ form, click the ‘View email history’ link.

See the list of emails, along with their details on the form.

Email Distributor Batch

After an admin works to configure email in D365, the system can send emails when various events occur.

First, when one of these events occurs, the system generates the email data and stores it in a staging table.

Second, the Email Distributor Batch job process reads this staging table, and does the work of sending out the email.

To explain, this is a two-step process to handle the scenario where the email server is unavailable. It is essential that email data not be lost; therefore, it is stored in a table. This way, if the email server is unavailable, the system can retry sending the email later.

To set up the Email Distributor Batch job, in D365 navigate to System administration>Periodic tasks>Email processing>Email distributor batch.

First, set the ‘Batch processing‘ flag to ‘Yes‘. Then, click on the ‘Recurrence‘ link to set up how often the batch job process should run.

Finally, click ‘Ok’ to create the batch job. If set up with a recurring schedule that never ends, this job only needs to be created once.

Microsoft Graph Settings

If you choose to use Microsoft Graph as an email provider, as recommended, navigate to the ‘Microsoft Graph settings‘ tab of the ‘Email parameters‘ form.

Follow these instructions to create an Application ID and Application secret in the Azure Portal.

Then, go back to D365 and fill out the ‘Application ID‘ and ‘Application secret‘ fields in the form.

Afterwards, use the ‘Test authentication’ and the ‘Test email’ functionality similar to the way it was described earlier.

Conclusion

Fortunately, administrators typically only need to configure email for D365 once in Production. Then they rarely need to make any changes unless the email provider or security information changes. That said, after a Production database is restored to a Test or Development environment, administrators may want to change the email configuration to prevent emails from being sent in non-production environments, as this could confuse customers. Additionally, this is why it is recommended that all customer email addresses be cleared out or changed after a database refresh. Finally, it is helpful to know how to configure email in D365, as developers in a Development environment may want to test changes they make to email templates.

Peter Ramer
Peter Ramer is a part of the Managed Application Services team at RSM working on Microsoft Dynamics 365. He focuses on the Retail and Commerce industries. When he is not solving problems and finding ways to accelerate his clients' business, he enjoys time with his three kids and amazing wife.

Share this:

One thought on “How To Configure Email In D365

Add yours

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑