From a841f066778cf87d7ccbd6a71a6f7a26ec91ca4a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 18 Dec 2012 13:29:35 +0100 Subject: [PATCH] [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 --- addons/mail/mail_thread.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 76e0a57330f..fc2a5547bd2 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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')])