[FIX] mail: Strip In-Reply-To header

For emails sent via Office 365, reply-to header could contains additional spaces
or get multiline header.
e.g.:
In-Reply-To:
	<4ba8f246904b4fedb49fbab7945a7f82@AM3PR06MB433.eurprd06.prod.outl$$k.com>

The message lookup fails if header is not stripped
This commit is contained in:
Jean-Baptiste Quenot 2014-07-24 15:37:18 +02:00 committed by Martin Trigaux
parent 69f87cd34c
commit 3d35a5d42b
2 changed files with 2 additions and 2 deletions

View File

@ -554,7 +554,7 @@ class mail_thread(osv.AbstractModel):
email_from = decode_header(message, 'From')
email_to = decode_header(message, 'To')
references = decode_header(message, 'References')
in_reply_to = decode_header(message, 'In-Reply-To')
in_reply_to = decode_header(message, 'In-Reply-To').strip()
# 1. Verify if this is a reply to an existing thread
thread_references = references or in_reply_to

View File

@ -533,7 +533,7 @@ class TestMailgateway(TestMailBase):
# 1. In-Reply-To header
reply_msg2 = format(MAIL_TEMPLATE, to='erroneous@example.com',
extra='In-Reply-To: %s' % msg1.message_id,
extra='In-Reply-To:\r\n\t%s' % msg1.message_id,
msg_id='<1198923581.41972151344608186760.JavaMail.3@agrolait.com>')
self.mail_group.message_process(cr, uid, None, reply_msg2)