Open GoogleCodeExporter opened 8 years ago
About the structure: it's not always reproduces so -- some times it looks well.
But still no attachment and raw message attachment part starts like this:
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: =?utf-8?b?dGV4dC9QTEFJTjsgY2hhcnNldD0idXRmLTgiOyBuYW1lPSI=?=
=?utf-8?b?0KTQsNC50LsudHh0Ig==?=
Content-Disposition: =?utf-8?b?YXR0YWNobWVudDsgZmlsZW5hbWU9ItCk0LDQudC7LnR4?=
=?utf-8?q?t=22?=
but should
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/PLAIN; charset="utf-8"; name="=?utf-8?b?0KTQsNC50LsudHh0?="
Content-Disposition: attachment; filename="=?utf-8?b?0KTQsNC50LsudHh0?="
I've fixed it with following change in mail_utils.py
def compose_rfc822(....)
....
from email.header import Header
attach.set_param(u'name', str(Header(attachment.filename)))
attach.add_header(u'Content-Disposition', u'attachment',
filename=str(Header(attachment.filename)))
but maybe there is more easy way to encode filename.
Original comment by akimov.alex
on 29 Sep 2010 at 1:38
I'm not able to reproduce the problem. As far as I can tell the attachment
headers are correct, for instance:
=?utf-8?b?dGV4dC9QTEFJTjsgY2hhcnNldD0idXRmLTgiOyBuYW1lPSI=?=
=?utf-8?b?0KTQsNC50LsudHh0Ig==?=
decodes to:
[('text/PLAIN; charset="utf-8"; name="\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb.txt"',
'utf-8')]
Which prints out:
text/PLAIN; charset="utf-8"; name="Файл.txt"
*However* we had a problem with the encoding of the file: when we download text
files we have to declare the character set in the "Content-Type" http header.
I've fixed that in the in r110.
Original comment by hguerreiro@gmail.com
on 5 Oct 2010 at 5:04
Well, as I understood, the only forbidden(like Cyrillic characters in filename)
characters should be encoded.
Anyway, I've tried to send message with "Файл.txt" and WebPyMail tells me
there is no attachment. Look in webpymail@gmail.com, FOLDER_SU5CT1g=/6/ . There
should be 2 atachments, but there is only one.
// By the way, maby you'll add Source view (or origin view) of message, at
least for debugging time? I've added it in my copy, but it's easier if it's in
repo.
Original comment by akimov.alex
on 7 Oct 2010 at 10:13
Original issue reported on code.google.com by
akimov.alex
on 29 Sep 2010 at 7:21Attachments: