[FIX] fetchmail: do not delete a failing email when using POP
In case of IMAP, the email is simply set as read but in case of POP, the email is deleted. To avoid loosing data (e.g. misconfiguration of server), the email is kept for POP. Bug lp:1296724, opw 605667
This commit is contained in:
parent
0ab88f54f9
commit
b160f99e2d
|
@ -236,12 +236,12 @@ openerp_mailgate: "|/path/to/openerp-mailgate.py --host=localhost -u %(uid)d -p
|
||||||
save_original=server.original,
|
save_original=server.original,
|
||||||
strip_attachments=(not server.attach),
|
strip_attachments=(not server.attach),
|
||||||
context=context)
|
context=context)
|
||||||
|
pop_server.dele(num)
|
||||||
except Exception:
|
except Exception:
|
||||||
_logger.exception('Failed to process mail from %s server %s.', server.type, server.name)
|
_logger.exception('Failed to process mail from %s server %s.', server.type, server.name)
|
||||||
failed += 1
|
failed += 1
|
||||||
if res_id and server.action_id:
|
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)})
|
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)})
|
||||||
pop_server.dele(num)
|
|
||||||
cr.commit()
|
cr.commit()
|
||||||
_logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", numMsgs, server.type, server.name, (numMsgs - failed), failed)
|
_logger.info("Fetched %d email(s) on %s server %s; %d succeeded, %d failed.", numMsgs, server.type, server.name, (numMsgs - failed), failed)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in New Issue