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 (firstname.lastname@example.org in my case).
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 email@example.com to send emails in the name of all D365FO users who will email reports.
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 firstname.lastname@example.org when emailing invoices or quotes. No matter if you email reports on demand or in batch, email@example.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. firstname.lastname@example.org). We have multiple options to support this:
- We can do the same thing as for the built emailing mechanism: configure Exchange to allow the user with email@example.com to send emails in the name of firstname.lastname@example.org and other accounts we will use for emailing (e.g. email@example.com).
- We can introduce aliases for firstname.lastname@example.org: email@example.com, firstname.lastname@example.org, etc. In both cases we have to configure our Exchange as described in this article.
- 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.
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. email@example.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 (firstname.lastname@example.org).
Let’s discuss this on an example. If we specify email@example.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 firstname.lastname@example.org, the default sender email email@example.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 firstname.lastname@example.org is an alias of email@example.com, or firstname.lastname@example.org is allowed to send emails in the name of email@example.com then emailing will work, otherwise not.
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 >>