eugene-eeo / mailthon

elegant email sending for Python
http://mailthon.readthedocs.org/en/latest/
MIT License
197 stars 19 forks source link

None-English word support in receiver and sender #27

Closed LeoQuote closed 8 years ago

LeoQuote commented 8 years ago

I want sender to be like this ['世界 <shijie@somedomain.cn>',"セかい<sekai@somedomain.jp>"] but it could not be well-organized , the code didnt do anything special for this case

https://github.com/eugene-eeo/mailthon/blob/master/mailthon/helpers.py#L38

How can I help to improve ,or that's impossible to improve?

eugene-eeo commented 8 years ago

I think it is handled- all headers are automatically encoded via the UnicodeHeaders dictionary. The main issue would be the "real" sender and whether that is handled if there is some non-ascii value (I.e. the value passed to conn.sendmail). I think the way to fix it is to modify the helpers.stringify_address function or looking into the helpers.format_addresses function and to add a test case for it as well.

eugene-eeo commented 8 years ago

If you're thinking about formatting the last one correctly - so you get "セかい <sekai@somedomain.jp>" then no, there is no easy way to improve it without looking into regexes, and we all know how hard it is to validate email addresses :smirk:

Closing it as unfixable.