Send mail as an impersonated user using Microsoft Graph API
Last updated
Was this helpful?
Last updated
Was this helpful?
Take control of your email appearance by using the Microsoft Graph API to send emails for you. Upload your own HTML templates into Rewst, and use them with the Microsoft Graph action. In the template, reference variables from the workflow to report on data gathered from workflows. The HTML Template lets you brand the email with your own custom logos and styling.
The Microsoft Cloud Integration Bundle must be setup, and working.
The user selected to send the email must exist in the Microsoft365 tenant called in the workflow.
A note about customer context:
If the workflow is running in the customer child organization, you can't send the email from the top level (MSP) domain. The email you send from needs to exist in the tenant the call is being made from. This can make implementing the graph send mail challenging for some workflows. If needed, you can do this by using completion handlers to send the email, instead of doing it within the primary workflow. This will allow you to send from the top level domain, regardless of the context the workflow runs in.
In the workflow builder, search for the action send mail as impersonated user.
Drag the Microsoft Graph action onto the canvas.
Fill out the required parameters, including:
Subject
User ID (AAD ID of sender)
We recommend you set this as an Organizational variable
Message Content
HTML Templates can be used here, as well as plain text
Message Content Type
This should match the type of the above content
To Recipient
An array of recipients
Other optional parameters include but are not limited to:
File attachments
Base 64 encoded file attachments. This could be a CSV generated by the workflow
Read Receipt
CC & BCC
Reply To
Tips
When used in conjunction with our core create webhook and await webhook actions, you can embed webhook links in the HTML message template for approval-related tasks.
Use free tools such as VS Code to render HTML for testing and creating templates.
Use Jinja in the HTML template to render data contained within the workflow.
You can embed your own logos in the HTML template. For example, the Rewst logo above is coded in the body: