[FIX] mail.thread.route: safer parsing of envelope headers, courtesy of Jordi Llonch

The Delivered-To cannot be considered
exclusively authoritative, as it is
commonly overwritten due to virtual
routes during mail delivery.
Its primary purpose is to avoid mail
loops, so it cannot be fully trusted 
here.

lp bug: https://launchpad.net/bugs/1085488 fixed

bzr revid: odo@openerp.com-20121218122935-vbcld3vrl260z96m
This commit is contained in:
Olivier Dony
2012-12-18 13:29:35 +01:00
parent 70e0d2860c
commit a841f06677
+3 -2
View File
@@ -338,8 +338,9 @@ class mail_thread(osv.AbstractModel):
# 2. Look for a matching mail.alias entry
# Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values
# for all the odd MTAs out there, as there is no standard header for the envelope's `rcpt_to` value.
rcpt_tos = decode_header(message, 'Delivered-To') or \
','.join([decode_header(message, 'To'),
rcpt_tos = \
','.join([decode_header(message, 'Delivered-To'),
decode_header(message, 'To'),
decode_header(message, 'Cc'),
decode_header(message, 'Resent-To'),
decode_header(message, 'Resent-Cc')])