kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

PDF attachment is corrupt #30

Open ghost opened 8 years ago

ghost commented 8 years ago

I'm trying to send an email with a pdf attachment.

yag = yagmail.SMTP('email@address.com') contents = ['This is the body, and here is just text', 'You can find a PDF file attached.', 'report.pdf']

yag.send('other@address.com', 'subject', contents)

The PDF cannot be opened by the receiver (it appears to be corrupt), but it's fine on the sender end. Is this an issue with Gmail SMTP?

kootenpv commented 8 years ago

It should indeed work.

What you're saying is that after you've sent it, it is possible for you to download it and view it, but the one who received it is not able to view it?

I have no idea what is going on. You could try inspecting the raw email message. If you'd like you could try sending me a PDF.

catastrophix commented 7 years ago

Thank you for your great work. I notice PDF attachments are not previewed in the recipient's Gmail web client.

Instead when I click on the PDF icon in the email, I get: "Whoops! There was a problem while displaying this image." in the web client and I am prompted to download the file after which, all is well (tested on two operating systems so far).

This is acceptable, but does raise some concern as to whether the PDF would be compatible on all platforms? Should I be worried?

kootenpv commented 7 years ago

@catastrophix Unfortunately, you are more knowledeable about this than me. I would assume a PDF is just a PDF, and it depends on google/gmail, microsoft etc how the choose to handle attachments (or specifically attachments sent by 3rd party apps, such as yagmail).

If you do investigate more, I'd be interested to hear if there is something we should be worried about :)

catastrophix commented 7 years ago

I will go forth. I have just over 100 emails to send each with a PDF attachment. A good sample size. I don't think the planet will stop turning if a few attachments are problematic. I will report back :)

kootenpv commented 7 years ago

@catastrophix Any news :)?