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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sending MIME email fai...
Power Automate
Unanswered

Sending MIME email fails when base64 encoded via Power Automate

(1) ShareShare
ReportReport
Posted on by 29

I'm trying to send email using Power Automate and the Graph API in MIME format. If I encode the email externally, it works fine but if I encode it using the encode64 function in Power Automate it throws an error `invalid base 64 string for MIME content`.

 

In the flow, there is an action containing the MIME string data, followed by two parallel branches. One Compose encodes the MIME data `base64(outputs('Compose_MIMEType'))` while the one in the parallel branch uses the already encoded string.

 

I used https://www.base64encode.org/ to encode it online in UTF-8 and LF (Unix) options. However I also tried it from https://base64.guru/converter/encode using "Base64 Standard = Main" and "Character Encoding = UTF-8" which resulted in a different Base64 encoded string that also worked fine.

 

Those are followed by two Outlook Send an Http Request actions which each respectively send the base64 encoded strings.

2fHV6j1M.png

There does not appear to be any difference between the two encoded strings after a character/character comparison but the action using the Power Automate encoded string fails.

GzSEa6QE.png

 

Here is the test email I'm using

To: me@gmail.com
Subject: Concert!
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="frontier"

--frontier
Content-Type: text/plain

Hey Jane,
Let's go as a team next Friday.
Depeche Mode concert!

--frontier
Content-Type: text/html

<html>
<body>
<p>Hey Jane,</p>
<p>Let's go as a team!</p>
<p>Depeche Mode concert next Friday.</p>
</body>
</html>

--frontier--

Base64 Encoded via online

VG86IG1lQGdtYWlsLmNvbQpTdWJqZWN0OiBDb25jZXJ0IQpNSU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IG11bHRpcGFydC9hbHRlcm5hdGl2ZTsgYm91bmRhcnk9ImZyb250aWVyIgoKLS1mcm9udGllcgpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4KCkhleSBKYW5lLApMZXQncyBnbyBhcyBhIHRlYW0gbmV4dCBGcmlkYXkuCkRlcGVjaGUgTW9kZSBjb25jZXJ0IQoKLS1mcm9udGllcgpDb250ZW50LVR5cGU6IHRleHQvaHRtbAoKPGh0bWw+Cjxib2R5Pgo8cD5IZXkgSmFuZSw8L3A+CjxwPkxldCdzIGdvIGFzIGEgdGVhbSE8L3A+CjxwPkRlcGVjaGUgTW9kZSBjb25jZXJ0IG5leHQgRnJpZGF5LjwvcD4KPC9ib2R5Pgo8L2h0bWw+CgotLWZyb250aWVyLS0=

Base64 encoded via Power Automate

VG86IG1lQGdtYWlsLmNvbQpTdWJqZWN0OiBDb25jZXJ0IQpNSU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IG11bHRpcGFydC9hbHRlcm5hdGl2ZTsgYm91bmRhcnk9ImZyb250aWVyIgoKLS1mcm9udGllcgpDb250ZW50LVR5cGU6IHRleHQvcGxhaW4KCkhleSBKYW5lLApMZXQncyBnbyBhcyBhIHRlYW0gbmV4dCBGcmlkYXkuCkRlcGVjaGUgTW9kZSBjb25jZXJ0IQoKLS1mcm9udGllcgpDb250ZW50LVR5cGU6IHRleHQvaHRtbAoKPGh0bWw+Cjxib2R5Pgo8cD5IZXkgSmFuZSw8L3A+CjxwPkxldCdzIGdvIGFzIGEgdGVhbSE8L3A+CjxwPkRlcGVjaGUgTW9kZSBjb25jZXJ0IG5leHQgRnJpZGF5LjwvcD4KPC9ib2R5Pgo8L2h0bWw+CgotLWZyb250aWVyLS0=

Error

{
 "error": {
 "code": "ErrorMimeContentInvalidBase64String",
 "message": "Invalid base64 string for MIME content."
 }
}

What am I missing? Is anyone else experiencing anything similar?

 

 

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,488 Super User 2025 Season 2 on at

    Hi @sbitaxi 

     

    Use base64tostring instead of just base64


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • sbitaxi Profile Picture
    29 on at

    Thank you Michael, but I don't believe that's the solution. base64tostring starts with a base64 string and decodes it.

     

    Action

    sbitaxi_3-1720609112137.png

    Result

    sbitaxi_5-1720609206781.png

     

     

    What I need is to encode to base64 which is why I used the expression that I did.

     

    I have this MIME formatted string in a Compose action

    To: me@gmail.com
    Subject: Concert!
    MIME-Version: 1.0
    Content-Type: multipart/alternative; boundary="frontier"
    
    --frontier
    Content-Type: text/plain
    
    Hey Jane,
    Let's go as a team next Friday.
    Depeche Mode concert!
    
    --frontier
    Content-Type: text/html
    
    <html>
    <body>
    <p>Hey Jane,</p>
    <p>Let's go as a team!</p>
    <p>Depeche Mode concert next Friday.</p>
    </body>
    </html>
    
    --frontier--

     and I need to convert it to base64 to send to Graph API (user: sendMail - Microsoft Graph v1.0 | Microsoft Learn)

     

    This works

    I put the base64 encoded value of the MIME string (above) into a Compose action

    sbitaxi_1-1720608902662.png

     

    and send it in a "Send an Http Request" Outlook action

    sbitaxi_0-1720608888350.png

    This fails

    Start with email in Compose action

    sbitaxi_2-1720609005198.png

    Encode it to base64

    sbitaxi_4-1720609159534.png

    Which results in the same base64 encoded string that I manually entered

     

    Then send it using an "Send an Http Request" Outlook action as above.

     

    Why is it different? The request body to Graph API is also the same.

     

     

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard