marrow / mailer

A light-weight, modular, message representation and mail delivery framework for Python.
MIT License
279 stars 62 forks source link

Attachments should be encoded with base64 #37

Closed fork- closed 9 years ago

fork- commented 12 years ago

Seems like agronholm looked at some emails I sent him with PDF attachments.

He said that attachments should be encoded with base64

So it seems as if this is the case and I was able to resolve it see here.

https://gist.github.com/dfee96dbd57bdeb3498f

zz85 commented 11 years ago

gmail rejects my binary attachments if they aren't base64 encoded. +1 for this

serhiip commented 10 years ago

Gist form link worked for me

disko commented 10 years ago

The proposal from the gist solves most of the problems I have with attachments, too. However, in Apple's Mail.app on OS X the attachments are still corrupt. This can be solved by adding a line break every 76 chars to base64 encoded string. Sth. like this did the job for me::

payload = '\n'.join(attachment[pos:pos+76] for pos in xrange(0, len(attachment), 76))

This is apparently also required by RFC1521.

amcgregor commented 9 years ago

Corrected in development and version bumped. Running some tests on my work codebases before release.

amcgregor commented 9 years ago

Committed code resolves issue.