Email archive for storing emails in Trac


This plugin allows you to browse and view archived emails and email attachments. It adds a new item Mail Archive to the main menu:

When clicking on an item in the mail archive, the contents can be viewed:

Key features:

  • Import emails to Trac's database from an IMAP account.
  • Search emails with Trac Search.
  • Link to emails or attachments with mailarchive: wiki links, or mail:, email:, and emailarchive: synonyms.
  • List relevant emails in wiki pages with the [[MailQuery(searchterm)]] macro.
  • New Trac permission MAIL_ARCHIVE_VIEW.
  • New Trac admin command trac-admin mailarchive fetch.

For example, you can schedule a task to call the following command every 15 minutes:

$ trac-admin path/to/trac/environment mailarchive fetch password123

Make sure that the emails to be archived are marked as unread or from today, as only such emails will be archived.

Known Problems

  • A reset of uids on the IMAP server could lead to problems, eg duplicate / unarchived emails (#11535).

Similar Plugins

Bugs/Feature Requests

Existing bugs and feature requests for MailArchivePlugin are here.

If you have any issues, create a new ticket.


3 / 6


3 / 4


0 / 1


Download the zipped source from here.


You can check out MailArchivePlugin from here using Subversion, or browse the source with Trac.


Installation of the plugin requires the usual step:

  • Trac 1.4: easy_install
  • Trac 1.2: easy_install
  • Trac 1.0: easy_install

Then enable the plugin in Trac's plugin admin page or in your trac.ini file:

mailarchive.* = enabled

A database upgrade will be required as usual:

$ trac-admin path/to/trac/environment upgrade


Assign the new MAIL_ARCHIVE_VIEW permission to the appropriate Trac groups / users, eg in Trac's permission admin page.

Additionally you need an email IMAP account that only contains all the emails you want to archive. If you don't already have this, you could create a new separate email account (e.g. and copy all emails you want to appear in Trac's mail archive to that account.

Actually archiving the emails from that IMAP account into Trac's database must be done separately using a new trac-admin mailarchive fetch <host> <username> <password> command. You should configure it to be periodically called, for example by using a cron job in Unix or using a scheduled task in Windows. Replace <host>, <username> and <password> with your email host, username and password.

Recent Changes

17666 by lucid on 2020-01-26 13:08:38
MailArchivePlugin: Python3 compatibility.
(see #13739)
17565 by lucid on 2019-11-18 18:02:16
MailArchivePlugin: Fix DB upgrades: Add upgrades to / eggs.
(fix #13647)
17557 by lucid on 2019-11-17 09:09:09
MailArchivePlugin: Add comment field and filter UI.

  • Fix Javascript folding (Jinja block head)
  • Bump version to 1.3

(fix #13647)
(fix #13648)



Author: lucid
Maintainer: lucid

Last modified 5 years ago Last modified on Aug 31, 2019, 10:40:22 AM

Attachments (2)

Download all attachments as: .zip