Send emails from D365FO using SendGrid

When sending emails from D365FO with an email service provider such as Exchange Online, receiving and sending limits normally apply. This can cause nasty problems when doing high-volume emailing, for example, emailing invoices in batch. Learn about Exchange online sending limits >>

The known limitation for Exchange Online is 10k emails per day. If your scenarios exceed this limitation, you will need to find another email service provider that does not impose such limitations. Luckily, there is a plethora of such SMTP providers you can choose from: SendGrid, Maligun, Sendinblue, SMTP.com, Pepipost, etc. Integration of these SMTP providers could be much more difficult than it initially appears, but by using Docentric, this becomes a fairly straightforward task. Docentric for D365FO allows you to seamlessly integrate with any other third-party email provider.

In this article, you will learn how to configure emailing settings in D365FO to work with SendGrid using Docentric for D365FO. SendGrid is a cloud-based SMTP provider that acts as an email delivery engine which improves email deliverability and provide simple integration. Learn more >>

Configuring SendGrid

To use SendGrid, you first need to create a SendGrid account and generate your API key. We will use this API key later for authentication when using the SendGrid service from D365FO.

Step 1: Create a SendGrid account

Sign up for a SendGrid account and select the plan that meets your business needs. We opened a free account for testing purposes. Once you have created the account, your will get a confirmation email for verifying the account.

Step 2: Single Sender Verification

SendGrid requires customers to verify their Sender Identities to protect the sending reputation. You can verify one or more Sender Identities using Domain Authentication or Single Sender Verification. A more detailed explanation of these options can be found in the SendGrid Documentation. In our example, we used Single Sender Verification as it is a fast way to verify Sender Identity and it is a recommended step for a quick start while building a proof of concept or test. For more details check the article on SendGrid >>

Configuring your SendGrid domain authentication will improve deliverability by proving to inbox providers that you own the domain you are sending from. Without this, your emails might end up in the spam folder.

Step 3: Create API Key

We need to create an API Key credential which will serve as authentication to the SendGrid service instead of a username and password. The API key name can be anything, but it is advisable to use a meaningful name you can recognize. We named our API key Docentric Dynamics AX and gave/granted Full access permission. Read more about API keys on >>

Configure SendGrid account in D365FO

You will most probably want to use a service like SendGrid for high-volume batch-based emailing only, while the standard Exchange Online can be used for everything else. Note that by default, D365FO does not allow you to configure more than one SMTP account, so this scenario cannot be achieved out-of-the-box in D365FO. The good news is that Docentric for D365FO Free Edition removes this limitation.

We will use the Docentric’s Additional email sender accounts feature to configure and use the SendGrid account. With this feature you have the possibility to configure multiple additional SMTP accounts and select which one of them will be used for emailing your reports. Learn more about additional email sender accounts capabilities >>

To configure the additional email sender accounts, go to the Docentric AX parameters > Emailing tab > Additional email sender accounts fast tab. Add a new record for the SendGrid account and specify the following:

  • Sender email – this is an email account which is defined as the Single Sender Verified account in SendGrid. In our case this is invoice@docentric.com. The recipients will see this value as the sender field.
  • User name – this is the login for SendGrid service, so we must set user name to the string "apikey".
  • Password – SendGrid’s API Key that was created in the API Key creation step.
    You will only be shown your API key once.
  • Outgoing mail server – SendGrid’s SMTP address which is smtp.sendgrid.net.
  • SMTP port number – SendGrid accepts unencrypted and TLS connections on ports 25, 587, & 2525. You can also connect via SSL on port 465. Many hosting providers and ISPs block port 25 by default. We recommend using port 587 to avoid any rate limiting that your server host may apply.

While configuring SendGrid, you can use the Docentric’s feature Send test email to test if the settings are valid. By clicking the Send test email button, a dialog with the pre-populated email message fields From, To and Subject is open, but you can modify them how suits you best and send the test email.

If the test has been successful, you will get an info message as shown below. If not, an error message will be displayed.

Our parameters are valid, so we got the info and received a test email from D365FO.

 

You are now all set and ready for sending emails!

Email invoices using SendGrid account with Docentric

As soon as we have successfully configured and tested the SendGrid connection, we can start sending emails from D365FO. Sending emails via SendGrid is no different than sending emails via Exchange Online. Let’s see how we can use the Docentric improved Email print destination to set-up emailing with the newly added SendGrid SMTP setting.

Unlike the built-in SSRS Email print destination, the Docentric Email print destination contains the From field, where the sender email address can be specified, which means that each report execution can use a different SMTP setting. I’m sure you will agree that this is quite an improvement over the built-in functionality!

Learn how Docentric improves emailing capabilities >>

Open Docentric Email Print destination settings for Customer invoice. Next, in the From field enter sender address for SendGrid which was added in the previous step. In our example this is invoice@docentric.com.

You can set up outgoing emails to contain various dynamic information such as Invoice ID, Customer name, Due date, etc. by using placeholders. You can even set up the From field to be dynamic. Learn more >>
If you leave the From field empty, the email address from SMTP settings in Email parameters will be used. Learn more >>

Not so complicated, right? Let’s now email a Customer invoice from Invoice journal using Print management. In our case, the email we received is below.

Conclusion

As you can see, setting up and using a different email service provider is quick and easy. Note that we used SendGrid just as an example and you are free to choose any other similar service. Moreover, with Docentric Free Edition you can easily set up multiple providers and sender SMTP settings in D365FO, and use each of them for different reports, based on the scenario or requirement.

If you need to solve the emailing problems described in this article, you can use Docentric Free Edition. As the name implies, Docentric Free Edition is a completely free-to-use portion of the full product. Download the solution right away and give it a try!

Leave a Reply

Your email address will not be published.

*

Docentric respects your privacy. Learn how your comment data is processed >>

Docentric respects your privacy. Learn how your comment data is processed >>