cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Ines
Level: Powered On

Corrupt PDF when sending as Gmail Attachment

(Before I explain, please note I've read about 5-10 other threads here on this forum about corrupt PDF attachments and none of the "solved" answers were really solutions. I've been at this for 6 hours now and am losing my mind.)

I have an online form that customers use to purchase ebooks. Flow starts when the form is submitted, and it's supposed to send purchased ebooks as email attachments via Gmail.

 

How the flow basically works:

  1. Get the ebooks from Google Drive using "Get file contents from path" -- works
  2. Get file names and types from Google Drive using "Get file metadata from path" -- works
  3. Append to array variable: -- works I guess
    {
    "Name": "body('Get_file_metadata_using_path')?['Name']",
    "ContentBytes": "body('Get_file_content_using_path')",
    "ContentType": "body('Get_file_metadata_using_path')?['MediaType']"
    }
  4. Send email with attachments. The array variable is added in the Attachments field.

 

Now, the email does get sent and the files do get attached - file sizes and names are okay.

BUT, the files are corrupted, I can't open or preview them.

I've tried so many things ... not using the array variable and just sending the files as is (adding the "File Content" dynamic content in the attachment field), tried using base64() conversion, base64toBinary(), just binary(), all possible conversions - I don't even know what these do. I tried changing filenames, tried declaring values with or without quotation marks, tried sending the email via SendGrid instead of Gmail, I just don't know what else to do and this thing is utterly broken. 

 

Help!

 

Screenshots:

https://ibb.co/dk64U9 -- Flow

https://ibb.co/m6sNGp -- Corrupted PDF
https://ibb.co/hZSB99 -- Corrupted PDF

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Corrupt PDF when sending as Gmail Attachment

Does this happen with any PDF? Or only with larger PDFs?

2 REPLIES 2
Super User
Super User

Re: Corrupt PDF when sending as Gmail Attachment

Does this happen with any PDF? Or only with larger PDFs?

Ines
Level: Powered On

Re: Corrupt PDF when sending as Gmail Attachment

Thank you!!

I didn't even think of file size because I was testing with 2-3 relatively small files (less than 2MB each) - but it looks like there's a limitation of around 5MB. 

 

I removed the Gmail connector and used SMTP instead - it works!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 145 members 4,575 guests
Please welcome our newest community members: