Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 3.53 KB

send-mail-as-an-impersonated-user-using-microsoft-graph-api.md

File metadata and controls

63 lines (41 loc) · 3.53 KB

Send mail as an impersonated user using Microsoft Graph API

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.

Prerequisites for impersonated email send

{% hint style="success" %} 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. {% endhint %}

Set up the Microsoft Graph send mail action

  1. In the workflow builder, search for the action send mail as impersonated user.

    An image of the Send Mail as Impersonated User action, retrieved from a search bar.

  2. Drag the Microsoft Graph action onto the canvas.

  3. Fill out the required parameters, including:

    1. Subject
    2. User ID (AAD ID of sender)
      1. We recommend you set this as an Organizational variable
    3. Message Content
      1. HTML Templates can be used here, as well as plain text
    4. Message Content Type
      1. This should match the type of the above content
    5. To Recipient
      1. 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

An image of the blank parameters menu for the Microsoft Graph action, ready to be filled out.

Find the parameters menu on the
right side of your screen.

{% hint style="info" %} 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. {% endhint %}

Example HTML template for new user approval

A screen captured image of a sample HTML template to send in a custom email

You can embed your own logos in the HTML template. For example, the Rewst logo above is coded in the body:

A screen capture of a snippet of HTML code showing how an image logo can be embedded into the template

Example HTML, with logo embedded in the code