cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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

Re: Corrupt PDF when sending as Gmail Attachment

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

View solution in original post

2 REPLIES 2

Re: Corrupt PDF when sending as Gmail Attachment

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

View solution in original post

Highlighted
Regular Visitor

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

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (10,098)