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 :
Power Platform Community / Forums / Power Automate / email attachment bad e...
Power Automate
Unanswered

email attachment bad encoding

(0) ShareShare
ReportReport
Posted on by 33

Whem I send an e-mail attachment with flow, the files get corrupted.


I guess it is sending in wrong encoding.

The original file looks like:
original_file.png

 

The file recivied in the e-mail looks like:

received_file.png

 

I have tried the "Get file content" and the "Get attachments content" actions, but without luck.

The mail sending:

image.png

 

Can anyone help me how to acheive the right encoding or recommend me a better way to send the files?

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at
    Re: email attachment bad encoding

    HI @Balony 

     

    First: In the Attachment name you need to end the name of the attachment with the .pdf extension else thsi will show error everytime. Please confirm this.

    Second: you are passing the content as a string and so it is messing that up. You need to put the content in binary(content) and then pass it in the variable and then to the attachment content. 

     

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • Balony Profile Picture
    33 on at
    Re: email attachment bad encoding

    Thanks for the advice,

     

    1. the filename is with extension .pdf, this is OK

    2. I have tried passing the content trought the binary() function:

       
    binary(body('Get_attachment_content'))

        but it did not help. 😞

  • v-bacao-msft Profile Picture
    on at
    Re: email attachment bad encoding

    Hi @Balony ,

     

    Could you share all the screenshots of the Flow configuration?

    As far as I know, the files transferred in Flow will eventually retain the type and content of the file.

    Flow does not actively encode files during execution.

    Please provide more details so that we could analyze your problem.

     

    Best Regards,

  • Verified answer
    Balony Profile Picture
    33 on at
    Re: email attachment bad encoding

    Problem solved,

    if I pass the body('Get_attachment_content')  directly to the 'attachments Content' it is working well, but if I put the body('Get_attachment_content') to a string variable, and this variable to the 'attachments Content' it is corrupting the encoding, maybe because the string variables in the flow are encoded in UTF-8.

     

    It would be great to have  'binary' type variables in flow.

  • thomas-broeth Profile Picture
    2 on at
    Re: email attachment bad encoding

    Hello,

     

    i could solve the issue when using

     

    base64ToBinary(items('Apply_to_each')?['contentBytes'])

     

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard