[IMP] mail: parsing emails with several html parts
authorMartin Trigaux <mat@openerp.com>
Thu, 9 Oct 2014 07:14:22 +0000 (09:14 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 9 Oct 2014 11:53:23 +0000 (13:53 +0200)
commitbd52298073f054ae817990a840d570b23c1e1a25
tree3935234786554b05e0a3527e6131ad2f39ba7099
parent03df412faf6f1d9a50dc28820d4637143e5bb8dd
[IMP] mail: parsing emails with several html parts

If an email contains several text/html parts inside a multipart email, the previous code was only keeping the last content part.
The Content-Type: multipart/mixed allows several independent part (RFC1341 7.2.2), so two html is technically valid.
With this patch, the two parts are concatenated. (opw 614755)

Modify append_content_to_html regex to make sure the regex keeps the content of the html instead of removing it.
e.g.: "123 <html> 456 </html> 789" used to be stripped to "123  789" while we expect "123 456 789"
addons/mail/mail_thread.py
addons/mail/tests/test_mail_gateway.py
openerp/tools/mail.py