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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Remove embedded images...
Power Automate
Suggested Answer

Remove embedded images from email body

(1) ShareShare
ReportReport
Posted on by 146
Hello,
I have a flow that monitors an email box folder for flagged emails. It copies the subject to a SharePoint list Single lIne of text column. The body of the email goes into a multiline of text column with rich text. Emails with images embedded in the email body cause the workflow to fail. How can I strip the image out of the body before copying the text to the SharePoint list?
Categories:
I have the same question (0)
  • Suggested answer
    Robu1 Profile Picture
    1,696 Super User 2026 Season 1 on at
    Hi    ,
     
    Thank you for choosing Microsoft Community.
     
    Use a Compose action with a regex replace to remove all <img> tags from the HTML body before saving it to SharePoint.
     
    I hope this helps resolve the issue! If you need more specific guidance, feel free to ask.
     
     
    🏷️ Please tag me @Robu1 if you still have any queries related to the solution or issue persists.
     
    ✅ Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future. ❤️ Please consider giving it a Like, If the approach was useful in other ways.
     
    Happy to help
    Robu 1👩‍💻
     
  • Suggested answer
    McPowerPlatform Profile Picture
    52 on at
    When the email body contains embedded images (<img> tags, inline CID images, base64 images, signatures, etc.). SharePoint multiline rich text fields often reject or choke on very large HTML generated by Outlook.

    Let me give you three approaches that can work well:

    Option 1: Removing all HTML and store plain text,  If you don't need formatting, insert an Html to text action before creating the SharePoint item.
    When a new email arrives (Trigger), Html to text Content: Body (Action) + Create item   Body column = Output of Html to text (Action)
    This approach strips images, HTML, formatting, and leaves only text.

    Option 2: Remove only IMG tags and keep formatting
    If you want to preserve HTML formatting but remove embedded images, use a Compose action with a regular expression replacement. 
    with a simple string replacement if you know the pattern,  if you have something like this: <img src="cid:image001.png@01DA..." /> 
    you could remove these with successive replace() expressions, like this replace(   outputs('Get_email')?['body/body'],   '<img', '<removedimg' )
    This is not ideal because the tag still remains.

    Option 3 (My Favorite) :  If preserving formatting is important, use Unique Body instead of Body, and write that to the SharePoint rich text field
    substring(  outputs('Get_email_(V3)')?['body/body'],   0,   60000 ) 
    If you can share the exact error message from the failed run and whether you're using When a new email arrives (V3), When an email is flagged, or another Outlook trigger.
    Let me know if this can help you
  • Suggested answer
    Haque Profile Picture
    3,570 on at
    Hi   ,
     
    You can disable the image with this syntax in Compose action:
    replace(replace(triggerOutputs()?['body/body'], '<img', '<!--img'), '/>', '-->')
    
    This syntax helps to comments out the <img> tags, disabling images in the HTML.
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    11manish Profile Picture
    3,152 on at
    For a mailbox-monitoring flow that archives emails into SharePoint:
    • Get Email (V3)
    • HTML to Text
    • Create/Update SharePoint Item
    • Subject = Email Subject
    • Body = HTML to Text output
    This removes all embedded images, signatures, and unsupported HTML while preserving the actual email content and is generally the most robust approach.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard