Monday, 7 January 2019

Email invoices using different From addresses in D365FO

In Microsoft Dynamics 365 for Finance and Operation, we usually get a requirement to email invoices from some dedicated From email address (e.g. invoicing@mycompany.com). Unfortunately, emailing reports using different From email addresses is not enabled in D365FO out of the box. Each outgoing email with a printed report is always sent from the email of the current user, for example tabsheer@mycompany.com.

Furthermore, if we select SMTP as the email provider (you can select Email provider in System administration > Setup > Email > Email parameters) we will also need to configure our mail server (for example Exchange Online) to allow the account specified in SMTP settings in Email parameters to send emails in the name of any user who emails reports.

Thus, when emailing reports in Dynamics 365 for Finance and Operations two problems can arise related to the sender email address:
  • We cannot specify From email address on outgoing emails (current user’s email address is always used).
  • Additional configuration of the outgoing mail server, e.g. Exchange Online is needed.
I was wondering how we could set From email address on outgoing emails with minimum customization. In my previous article I discussed how to email invoices with the HTML email body and additional documents attached. I used a free tool call Docentric to achieve that and among other things, the same tool allowed me to specify From email address when emailing invoices.

Namely, Docentric enables you to enter an arbitrary From email address when emailing reports directly on the Print destination settings form. If you leave the From email address field on the Print destination settings form empty, the account specified in SMTP settings in Email parameters will be used.































How to Set Up Multiple From Addresses using Docentric:

In the Docentric AX Parameters form we can setup multiple From email addresses in the Additional From email accounts section and this way avoid creation of aliases on our Exchange Online for the account specified in SMPT settings in Email parameters.

Note: In my case I have provided two additional From email addresses.
Navigation: Organization administration -> Docentric AX -> Docentric AX Parameters -> Emailing (Tab)














Additional From email accounts
contains the following information:
  • User name: From email address (i.e. user account).
  • Password: Password of the user account.
  • Outgoing mail server: SMTP mail server we will use to send emails from D365FO (In my case I have provided Gmail mail server).

How to Use Multiple From Addresses Without Needing to Configure Exchange Server:

Docentric free-edition tool added a great value by enabling us to set up multiple SMTP accounts and/or outgoing mail servers directly in D365FO, and then use them to email SSRS reports or emails based on Email templates.

How this mechanism works? If we specify an email address in the From email address field in the Print destination settings form when emailing a report (e.g. Customer invoice), Docentric will try to locate this email address in Additional From email accounts first. If found, this account will be used. If not found, then the fallback to Default From email account will occur, which means that the account from SMTP settings in Email parameters will be used.

Note: For further detailed understanding, you can refer to this link.













After we finish with the setup, we need to set From email address in the Print destination settings form. For this example, I want to use "khan.tabshir@gmail.com" as From email address.
























Now simply generate the SSRS report. (In my case I used the Customer Invoice report).












Here in the below screenshot you can see that the outgoing email was sent from our custom Form email address (khan.tabshir@gmail.com).












On the other hand, if we leave the From email address field on the Print destination settings form empty, the resulting email will be sent from the email address specified in SMTP settings in Email parameters:











So far, I found many benefits of Docentric free-edition tool, especially for emailing reports. In this article, we saw how to set up different From email addresses when emailing invoices without the need to configure our mail server, and in my previous articles you can read how to set up the email body and additional email attachments, or how to monitor and resend failed emails with printed reports.

No comments:

Post a Comment

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...