cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

View solution in original post

2 REPLIES 2

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

View solution in original post

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (48,975)