marrow / mailer

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

Attach files with filenames that include non-ASCII characters #69

Closed stevenbuccini closed 7 years ago

stevenbuccini commented 7 years ago

RFC 2231 allows us to specify a language and a charset for filenames that include non-ASCII characters. Python's email module already includes some nifty functionality to handle this. This PR simply exposes that functionality to users of marrow/mailer.

stevenbuccini commented 7 years ago

Unsure of why these tests are failing on Python3 -- looks to be a broader issue than just my tests.

stevenbuccini commented 7 years ago

cc: @amcgregor, just want to bring this to your attention.

amcgregor commented 7 years ago

Thanks again!

stevenbuccini commented 7 years ago

Do you plan on releasing a bumped version on PyPi? Would make pulling this commit into my project a lot easier. Thanks!

amcgregor commented 7 years ago

Aye; I'll try to tackle that (and fixing these tests…) for a release this week-end.

stevenbuccini commented 7 years ago

Just curious if you had an update on this! Thanks!

amcgregor commented 7 years ago

Yeah… spent a ludicrous amount of time this week-end wrangling with the tests. Things like the DNS package used previously is not Python 3 compatible, nor was the mock SMTP server. Migration to Pytest (from Nose) is also part of this. T'was a bit bigger of a job than two afternoons on the week-end could account for. I'll continue updating/fixing them as the week progresses and will re-try for a release next week-end.

stevenbuccini commented 7 years ago

No worries, didn't realize it would be such a big deal! Thanks so much for slogging through it for a minor change. I do appreciate it.

amcgregor commented 7 years ago

It never hurts to help. 😆

amcgregor commented 7 years ago

Tests pass on all supported platforms now.

There's an interesting oddity between Python 2 and 3, where the encoded filename is quoted in Python 2, but not quoted in 3. I've verified that unquoted is acceptable according to the RFC, so no damage beyond extra conditionals in the tests. I've shoved the major test update (ripping out the DNS bits, etc.) into a branch and will roll a release including the changes/fixes so far on Saturday.

Could you do me a huge favour and double-check that the current develop branch operates according to your expectations?

Thanks!

amcgregor commented 7 years ago

@stevenbuccini https://github.com/marrow/mailer/releases/tag/4.0.2 :)

stevenbuccini commented 7 years ago

@amcgregor Just seeing this now! Thank you so very much. I really appreciate your dedication to the issue; I know it was a major task getting the tests in order for such a small fix.