Sending Email from Admin on behalf of sender in Business Central using MS Flows
Introduction:
In Business Central, to send an Email the sender Email is always the user in SMTP Setup. But, what happens when you are sending email from <[email protected]> but should be going department wise ie. <[email protected]> and <[email protected]>. Thus in this blog I’ll be showing how to send email from the department email using the admin email.
Pre-requisite:
1. VS Code.
2. Office 365.
3. Microsoft Dynamics Business Central.
4. MS Flows.
Demonstration:
1. Setting Up MS Flows:
- Creating the HTTP request:
- Using Sample Payload as :
[{ "sender":"Test Sender", "recepient":"Test recepient", "subject":"Test Subject", "body":"Test body" }]
-
Add the Send an Email action:
- Save the MS Flow and copy the trigger URL in Postman and passing JSON, check if you the email.
- Check mail box for delivery of Email
2. Enable email delegation in Office 365.
In portal.office.com, navigate to Admin > Admin Center > Exchange > Mail boxes > <–Admin Email–> > Delegate
Add you department email here. In this cas [email protected] is admin email and [email protected] is department email.
3. Call the MS Flows from Business Central.
Code:
4. Output
Conclusion:
Thus in this way we can use MS Flows Webhooks to actually trigger an email passing the data through JSON as an POST http request.