Merge lp:~openerp-dev/openobject-server/6.0-bug-732512-xrg into lp:openobject-server/6.0
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~openerp-dev/openobject-server/6.0-bug-732512-xrg | ||||
Merge into: | lp:openobject-server/6.0 | ||||
Diff against target: |
200 lines (+91/-25) 1 file modified
bin/tools/misc.py (+91/-25) |
||||
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/6.0-bug-732512-xrg | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP buildbot (community) | Approve | ||
Review via email: mp+52827@code.launchpad.net |
Unmerged revisions
- 3363. By xrg
-
tools/misc: try harder to encode smtp address headers
Problem is that encoding the full header (comma-separated list of
email addresses) in one =?c?...?= chunk is not properly handled by
some mail transport agents[1]. Even worse, when parts cannot fit
into one 76-char line (note that utf-8 over base64 tends to be rather
long), Postfix thinks each line is another address, that it decides
to trivial-rewrite and append domain name etc.
In another case noted, invalid chars (not properly encoded) or half-
addresses were adding to the spam-score of mails.Solution: according to RFC 2047, we can have multiple encoded-words
(the =?.?..?= part) as any whitespace-delimited part of the header.
We /cannot/ have them inside quoted strings like "=?..?=", but need
to include the quotes inside the encoded-word.
The patch splits the address tokens to their smallest allowed "words"
and then tries to encode them one by one. Hopefully, names may need the
encoding, while emails will be pure us-ascii and will be appended
verbatim. It also includes support for one 'hint' encoding (iso8859-7 in
my case, for example) that would have shorter representation than utf-8.
Saves the day for some long names.Note: a side-effect is that we add one space /before/ the comma when
we separate multiple addresses, like ' "Me" <me@here> , "Him" <him@there>'
It should be tolerated by the protocol, AFAICT.[1] I've experienced it all these years we've been sending Greek names
in our From/To addresses. My maildirs are full of examples.
(cherry picked from commit 7fb0827e94b50b88d003c7c0b37abd 918eed98ec) - 3362. By xrg
-
misc/email: improve, utf-8 aware headers, better logging.
Some trivial improvements to email_send():
- use pythonic logger
- have one debug() line and one info() line before and after sending
a message, respectively
- if message is plain, don't do multipart, but simple email
- if any header is non-latin, encode it with email.Header()
- otoh, if mail is latin, don't encode it.
(cherry picked from commit 9c025f545a086e80c2258c35abada8 084ccabf2f)