Mail cleanup

mail_cleanup
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/18.0/mail_cleanup
VERSION
VERSION 1.0.2
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSDenis Leemann, Weblate, OCA-git-bot, oca-ci, Ricardoalso
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:07
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - mail_environment
    - server_environment
odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - html_editor
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
## This module allows to:

- mark e-mails older than x days as read,
- move those messages in a specific folder,
- remove messages older than x days on IMAP servers, just before
  fetching them.

Since the main "mail" module does not mark unroutable e-mails as read,
this means that if junk mail arrives in the catch-all address without
any default route, fetching newer e-mails will happen after re-parsing
those unroutable e-mails.

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits mail.view_email_server_form
Models touched (1)

New fields (3)
  • cleanup_days Integer
    help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self, raise_exception=True)
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/16.0/mail_cleanup
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, ntsirintanis
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:53:53
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - mail_environment
    - server_environment
odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits mail.view_email_server_form
Models touched (1)

New fields (3)
  • cleanup_days Integer
    help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self)
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/14.0/mail_cleanup
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, HoDacSon
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:41:05
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - mail_environment
    - server_environment
odoo/odoo:
    - fetchmail
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits fetchmail.view_email_server_form
Models touched (1)

New fields (3)
  • cleanup_days Integer
    help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self)
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/12.0/mail_cleanup
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSjcoux, oca-travis, Weblate, OCA-git-bot
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:29:22
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - mail_environment
    - server_environment
odoo/odoo:
    - fetchmail
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits fetchmail.view_email_server_form
Models touched (1)

New fields (3)
  • cleanup_days Integer
    help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self)
    @api.multi
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/11.0/mail_cleanup
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSAkim Juillerat, OCA Transbot, oca-travis, Weblate, OCA-git-bot, Artem Kostyuk, oca-ci
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:24:00
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-env:
    - mail_environment
    - server_environment
odoo/odoo:
    - fetchmail
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
    - base_sparse_field
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits fetchmail.view_email_server_form
Models touched (1)

New fields (3)
  • cleanup_days Integer
    help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self)
    @api.multi
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/9.0/mail_cleanup
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSStéphane Bidoul (ACSONE), OCA Transbot, Dave Lasley, oca-travis, OCA-git-bot
WEBSITE
WEBSITEhttps://odoo-community.org
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:15:22
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-tools:
    - mail_environment
    - server_environment
odoo/odoo:
    - fetchmail
    - mail
    - base
    - base_setup
    - web_kanban
    - web
    - bus
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits mail_environment.inherit_fetchmail
Models touched (1)

New fields (3)
  • cleanup_days Integer
    compute='_get_cleanup_conf' help='Number of days before marking an e-mail as read' string='Expiration days'
  • cleanup_folder Char
    compute='_get_cleanup_conf' help='Folder where an e-mail marked as read will be moved.' string='Expiration folder'
  • purge_days Integer
    compute='_get_cleanup_conf' help='Number of days before removing an e-mail' string='Deletion days'
Public methods (1)
  • fetch_mail(self)
    @api.multi
    Called before the fetch, in order to clean up right before retrieving emails.
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/7.0/mail_cleanup
VERSION
VERSION 0.1
CATEGORY
CATEGORYTools
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSMatthieu Dietrich
WEBSITE
WEBSITEhttp://openerp.camptocamp.com
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:07:15
ODOO DEPENDENCIES
ODOO DEPENDENCIES OCA/server-tools:
    - mail_environment
    - server_environment
odoo/odoo:
    - mail
    - base
    - base_setup
    - web_kanban
    - web
    - fetchmail
    - crm
    - base_action_rule
    - base_status
    - process
    - email_template
    - base_calendar
    - resource
    - board
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
    :alt: License: AGPL-3

Mail cleanup
===========

This module allows to mark e-mails older than x days as read
and optionally move them on IMAP servers, just before fetching them.

Since the main "mail" module does not mark unroutable e-mails as read,
this means that if junk mail arrives in the catch-all address without
any default route, fetching newer e-mails will happen after re-parsing
those unroutable e-mails.

Configuration
=============

This module depends on ``mail_environment`` in order to add "expiration dates"
per server.

Example of a configuration file (add those values to your server)::

 [incoming_mail.openerp_pop_mail1]
 cleanup_days = 30 # default value
 cleanup_folder = NotParsed # optional parameter

Known issues / Roadmap
======================

* None

Credits
=======

Contributors
------------

* Matthieu Dietrich <matthieu.dietrich@camptocamp.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.

Code Analysis

Views touched (1)
XML IDNameModelTypeStatus
inherit_fetchmail_cleanup inherit_fetchmail_for cleanup fetchmail.server field Inherits mail_environment.inherit_fetchmail
Models touched (1)

New fields (0)

No new fields.

Public methods (1)
  • fetch_mail(self, cr, uid, ids, context=None)
    Called before the fetch, in order to clean up right before retrieving emails.
STATUS
STATUSOpen migration PR - not merged yet for this version
REPOSITORY
REPOSITORYOCA/server-tools
PULL REQUEST
PULL REQUEST[19.0][MIG] mail_cleanup: Migration to 19.0 (#3618)