Skip to content

Commit

Permalink
[FIX] mail: removing whitespace on message_id from incoming mail
Browse files Browse the repository at this point in the history
Because of a whitespace character present at the beginning of the message_id of some mails,
they were fetched twice.

From the SQL side, we see that Outlook is formatting the header following the RFC822
by allowing the header to look like:

Header:<CRLF>
<whitespace><hash_of_msg_id>

From RFC822:
"Each header field can be viewed as a single, logical line of ASCII characters.
For convenience, the field-body portion of this conceptual entity can be split
into a multiple-line representation" (abr.)

It was also possible to find out by checking the logs.
One or two whitespace(s) can be seen before the hash of the msg_id.

The following commit is making sure we use and save the message_id without the whitespace
by stripping them off on the coming mail.

OPW-2006806

closes #35682

Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
  • Loading branch information
Abridbus committed Aug 13, 2019
1 parent af3f6e5 commit cc07299
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/mail/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ def message_parse(self, message, save_original=False):
message = message.encode('utf-8')
message = email.message_from_string(message)

message_id = message['message-id']
message_id = message['message-id'].strip()
if not message_id:
# Very unusual situation, be we should be fault-tolerant here
message_id = "<%s@localhost>" % time.time()
Expand Down

0 comments on commit cc07299

Please sign in to comment.