From bc0232cee63c2dbc79e2d9b93c8c10e034bc385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 12 Feb 2014 17:08:57 +0100 Subject: [PATCH] [FORWARD] [FIX] Forward port of revision 6920 of 6.1 addons branch. Revid: revid:odo@openerp.com-20120727150051-e1q0m92tyrazz82f Purpose: some fixes and more robuts handling of incoming emails bzr revid: tde@openerp.com-20140212160857-s889npk2q133xvy2 --- addons/fetchmail/fetchmail.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index d408e7da9ac..ae3d60cee0a 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -198,6 +198,7 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p result, data = imap_server.search(None, '(UNSEEN)') for num in data[0].split(): result, data = imap_server.fetch(num, '(RFC822)') + imap_server.store(num, '-FLAGS', '\\Seen') res_id = mail_thread.message_process(cr, uid, server.object_id.model, data[0][1], save_original=server.original, @@ -205,8 +206,8 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p context=context) if res_id and server.action_id: action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id], 'active_model': context.get("thread_model", server.object_id.model)}) - imap_server.store(num, '+FLAGS', '\\Seen') - cr.commit() + imap_server.store(num, '+FLAGS', '\\Seen') + cr.commit() count += 1 _logger.info("fetched/processed %s email(s) on %s server %s", count, server.type, server.name) except Exception: