Email reports from multiple sender addresses in Dynamics 365 for Finance and Operations

When it comes to emailing reports from DYN365FO, we are all facing the same problem: it’s simply too limited. For example, we cannot set up the email body or additional email attachments nor we can use placeholders to make the email subject and output filename dynamic (e.g. Invoice <Invoice ID>.pdf). This is where Docentric AX Free Edition comes handy – it will allow you all of this plus it costs nothing; in other words, it’s a completely free Add-On for Dynamics 365 for Finance and Operations.

In this article we will discuss another pretty big limitation – when emailing reports you cannot specify who is the sender of outgoing emails (i.e. the From email address). Docentric AX Free Edition will help you to overcome this limitation. We will first explain how built-in SSRS report emailing works and afterwards how it is improved by Docentric.

Email reports using built-in Email print destination

No matter if you email invoices or purchase orders, the sender email address will always be the same – the current user email address will be used. More precisely, the email address of the current user if it is set in User options, otherwise the one that is set on the Users form (miha.vuk@docentric.com in my case).

 

When emailing reports in batch, the email of the user which scheduled a particular batch job will be used as the sender email address. His or her email address will be picked up from User options at the time of the batch job execution, so we can all agree that a potential workaround with changing email address in User options is not really an option.

Why my outgoing emails usually fail when using SMTP email provider

If you are using SMTP as non-interactive, i.e. Batch email provider, the account specified in SMTP settings in Email parameters is actually going to be used for sending emails via Outgoing mail server. Consequently, if this account is not configured to allow sending emails in the name of each D365FO user who emails reports, emailing will fail.

In order to fix this, what you need to do is to properly configure your outgoing mail server (Exchange) to allow sending emails from other accounts, i.e. email addresses. In our case, we need to allow test@docentric.com to send emails in the name of all D365FO users who will email reports.

Learn how to configure Exchange >>

On the other hand, if you select Exchange as Batch email provider, the current user will send emails in his or her own name, so these problems here shouldn’t exist.

Email reports using Docentric Email print destination

Using Docentric AX Free Edition you can specify the sender per each report execution, which is really nice. Unlike the built-in (SSRS) Email print destination, Docentric Email print destination contains the From field, where the sender email address can be specified. For example, you can specify sales@docentric.com when emailing invoices or quotes. No matter if you email reports on demand or in batch, sales@docentric.com will act as the From email address.

If you leave the From field empty, the email address from SMTP settings in Email parameters will be used. If you still want to use the current user email from User options, as the built-in emailing mechanism does, you can simply specify @USEREMAIL@ placeholder in the From field.

 

The question is how this can possibly work when we have only one account in SMTP settings in Email parameters (e.g. test@docentric.com). We have multiple options to support this:

  1. We can do the same thing as for the built emailing mechanism: configure Exchange to allow the user with test@docentric.com to send emails in the name of sales@docentric.com and other accounts we will use for emailing (e.g. purchase@docentric.com).
  2. We can introduce aliases for test@docentric.com: sales@docentric.com, purchase@docentric.com, etc. In both cases we have to configure our Exchange as described in this article.
  3. There is more – from Docentric 3.3.2 version we added one cool option: you can now set up and use multiple SMTP accounts or even multiple outgoing mail servers. We will explain this option in the next chapter.

Multiple SMTP accounts

Sending emails from multiple sender addresses using the single SMTP account from SMTP settings in Email parameters is still cumbersome. It requires security changes on mail server, which can pose some security risks and certainly involves mail server administrators.

Another scenario which is not supported by common mail servers including Exchange Online is massive emailing. You can check here about Exchange Online limitations. To enable mass emailing you need to use a third party STMP provider such as SendGrid that runs in Azure, which usually requires a payed subscription.

Conclusion? It would certainly be of great value if we could set up and use multiple SMTP accounts within the same or different mail servers in D365FO directly. This way you wouldn’t need to contact your administrator and ask him to configure aliases and permissions on Exchange to get your reports emailed, nor to customize D365FO to enable mass emailing.

This is why we decided to introduce this kind of support for multiple SMTP accounts and/or outgoing mail servers in D365FO. The good news is that this also is part of Docentric AX Free Edition so you would be able to email your SSRS reports and emails based on Email templates from multiple sender addresses configured right there in D365FO. You can find the setup in Docentric AX parameters -> Emailing.

When you specify an email address in the From field (e.g. sales@docentric.com) in the Print destination settings form when emailing a report (e.g. Customer invoice), Docentric will try to locate this email address in Additional email sender accounts first. If found, this account will be used (as in our case). If not found, the fallback to Default email sender account will occur and the account from SMTP settings in Email parameters will be used (test@docentric.com).

Let’s discuss this on an example. If we specify sales@docentric.com as From when emailing a report, the alternative sender account from Additional email sender accounts will be used. On the other hand, if we specify an email address that is not found in Additional email sender accounts, for example purchase@docentric.com, the default sender email test@docentric.com will be used. Whether such an email will be successfully sent or not depends on the configuration of your Exchange Online. In other words, if purchase@docentric.com is an alias of test@docentric.com, or test@docentric.com is allowed to send emails in the name of purchase@docentric.com then emailing will work, otherwise not.

In 3.4.3 version, we introduced an additional field for matching against the From field of outgoing emails sent from D365FO via Docentric email provider: Sender email. The User name field is still used as the login account to the outgoing mail server and it is usually the same as Sender email. It can differ from Sender email if you want to use aliases for account selection or the account username is not an email address. Learn more >>

See also

Troubleshooting techniques for solving emailing issues in D365FO >>
Monitor and resend outgoing emails with printed invoices in D365FO >>
Log errors of Email distributor batch in D365FO >>
Send emails from D365FO using SendGrid >>

Leave a Reply

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

*

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

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