web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to send an email template with an attachment dynamically?

(0) ShareShare
ReportReport
Posted on by 905

Hello,


I wanted to know if it is possible to send an email template including an attachment dynamically by performing the unbound action "SendEmailFromTemplate" in Power Automate cloud flows.


This amazing blog post covers what I am looking for:
https://linnzawwin.blogspot.com/2022/10/generate-document-from-word-template.html?sc=1680760985532#c4723434891612517795


However, the only difference is that my email templates are in the "Email Template table" which already includes subject, body, and personalization variables included dynamically.

The below action can be used to create a draft email:
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/instantiatetemplate?view=dataverse-latest

I am still stuck on how to build the below on Power Automate:

1. Creating Draft Email (From InstantiateTemplate action)

2. Creating the attachment and adding an attachment to the notes

3. Sending the email


Can you please show a small example of how to achieve that?


Any help is greatly appreciated.

EBMRay

I have the same question (0)
  • EBMRay Profile Picture
    905 on at
    RE: How to send an email template with an attachment dynamically?

    Hello Steve Zhao2,

    I would highly appreciate your assistance regarding this topic.

    Thank you!

  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    RE: How to send an email template with an attachment dynamically?

    Hi EBMRay,

    Refer to the following steps to create draft Emails (From InstantiateTemplate action) in power automate:

    1.Get the email template ID you need:

    --My example email template:

    pastedimage1681191570477v2.png

    2.Perform an unbound action--InstantiateTemplate:

    pastedimage1681191785637v4.png

    --ObjectType: Logical name of the entity in the email template category

    --ObjectId: Email templates are based on which record is inserted(in my example, i want to apply template based on one contact(To field)--Leah Ju)

    pastedimage1681192236175v5.pngpastedimage1681192313116v6.png

    3.Compose--Get body of the action:

    pastedimage1681192427546v7.png

    4.Parse JSON

    https://www.m365princess.com/blogs/2021-02-08-how-to-use-parse-json-action-in-power-automate/ 

    pastedimage1681192514540v8.png

    {
        "type": "object",
        "properties": {
            "@@odata.context": {
                "type": "string"
            },
            "value": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "@@odata.type": {
                            "type": "string"
                        },
                        "subject": {
                            "type": "string"
                        },
                        "description": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "@@odata.type",
                        "subject",
                        "description"
                    ]
                }
            }
        }
    }

    5.Add a new row

    --Apply to each action will be added automatically after setting subject and description

    pastedimage1681192596933v9.png

    pastedimage1681192655701v10.png

    Now you can add attachments and send emails on power automate (just as described in the first blog you provided).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 83 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 79

#3
Martin Dráb Profile Picture

Martin Dráb 67 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans