aspineux / pyzmail

Pyzmail is a high level mail library for Python, providing functions to read, compose and send emails
59 stars 31 forks source link

Attachment corruption using pyzsendmail #8

Closed xiconet closed 9 years ago

xiconet commented 9 years ago

Sir,

Before all, thanks for your hard work in order to provide a more user-friendly email library. However I've made various attempts to send an attachment using the included pyzsendmail which have all proven unsuccessful. My files somehow got "corrupted" (they seem "tailed") when downloading them back. I tried both application/x-bittorrent and image/jpg types with similar results. I did inspect the code, but I still fail to see where the problem could lie. Note that I could send the very same files in similar conditions (sender=recipient=me, smtp server) without corruption, using python's "low level" email and smtplib libs.

Settings: WinXPsp3, python 2.7.6, pyzmail package installed with a "standard" pip command.

aspineux commented 9 years ago

Could you give me a test case that fail ?

xiconet commented 9 years ago

Running WindowsXP-sp3, python 2.7.6, no "resident" (scanning) antivirus

pip install pyzmail

PATH includes C:\python27\scripts where the pyzsendmail script is located

using cmd.exe:

pyzsendmail -H smtp.free.fr -f me@free.fr -s test -t me@yahoo.fr -T :"testing pyzsendmail with torrent attachment" -a application/octet-stream:test_torrent:test.torrent

or:

pyzsendmail -H smtp.free.fr -f me@free.fr -s test -t me@yahoo.fr -T :"testing pyzsendmail with image attachment" -a image/jpeg:test_image:test.jpg

access yahoo mail using webclient, browser is Pale Moon 25.3.1 (x86) download attachments

test downloaded_test

aspineux commented 9 years ago

This a bug ! Attachments are open in "text" mode on Windows platform. I have pushed a fix, but no new release yet. You can look at the fix and apply it yourself on your sources and see if it works better for you

https://github.com/aspineux/pyzmail/commit/a01570fd135f8428a548bf4317485ea1b878353c

xiconet commented 9 years ago

Yes, problem fixed. I must have been been half asleep when I looked at your script. Thanks a lot for your help.