diff options
| author | Olivier Dony <odo@openerp.com> | 2017-03-07 19:53:01 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2017-03-07 19:53:06 +0100 |
| commit | 2d3a4a5d0cb2dbdd9a941d480b4989d7921c6100 (patch) | |
| tree | d9fc40468df200c0a37f151e3adac20ec1ccb5bb | |
| parent | 31e81e7b8f8803abf0496e10ce0c25c4921030f7 (diff) | |
[FIX] tools: generate message IDs with unique prefix
For the purpose of fighting spam, many abuse/spam-fighting
services provide redacted message IDs. Because we use a UNIX
timestamp as the prefix for all message IDs, a redacted
message ID of the form 1234XXXXX@domain.com is generally
useless to find a `flagged` message's origin, because it
matches most of the messages sent that day.
Narrowing it down with the help of the approximate time
of delivery does not help much, as there will still be
dozens/hundreds of possible matches on a busy server.
By swapping around the random token and the timestamp in
the message ID, we should improve the uniqueness and
"greppability" of our message IDs, once redacted.
| -rw-r--r-- | odoo/tools/mail.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index cff0779a658..e1a4eeb9c54 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -436,7 +436,7 @@ def generate_tracking_message_id(res_id): except NotImplementedError: rnd = random.random() rndstr = ("%.15f" % rnd)[2:] - return "<%.15f.%s-openerp-%s@%s>" % (time.time(), rndstr, res_id, socket.gethostname()) + return "<%s.%.15f-openerp-%s@%s>" % (rndstr, time.time(), res_id, socket.gethostname()) def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attachments=None, message_id=None, references=None, openobject_id=False, debug=False, subtype='plain', headers=None, |
