[FIX] l10n_it_edi: imap seen flag more compatible
For an imap "PEC server" we will fetch mail and set \Seen flag according to current value. But the way imaplib was used seem to possibly cause an issue on some particular mail providers. Mailing RFC* gives example of adding flags with parenthesis around flag: eg. "A003 STORE 2:4 +FLAGS (\Deleted)" but we are sending these command wihtout parenthesis (which seems to be working, but apparently not for some providers). To fix this issue, we change how we use the API to do the same thing than in fetchmail module that is a lot more battle tested (and from logs is sending flags in parenthesis). * https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.6 fixing #89305 fixing #81443 opw-2714596 closes odoo/odoo#89379 X-original-commit: 7dd5437a65bd43a91d6ae7e2fb4f11f2f0b1476b Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -84,9 +84,9 @@ class FetchmailServer(models.Model):
|
||||
|
||||
# To leave the mail in the state in which they were.
|
||||
if "Seen" not in data[1].decode("utf-8"):
|
||||
imap_server.uid('STORE', uid, '+FLAGS', '\\Seen')
|
||||
imap_server.store(uid, '+FLAGS', '\\Seen')
|
||||
else:
|
||||
imap_server.uid('STORE', uid, '-FLAGS', '\\Seen')
|
||||
imap_server.store(uid, '-FLAGS', '\\Seen')
|
||||
|
||||
# See details in message_process() in mail_thread.py
|
||||
if isinstance(message, xmlrpclib.Binary):
|
||||
|
||||
Reference in New Issue
Block a user