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:

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).

Bugs/Feature Requests

Existing bugs and feature requests for MailArchivePlugin are here.

If you have any issues, create a new ticket.


0 / 2


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.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

16565 by rjollos on 2017-05-01 01:40:27
Fix indentation
16138 by lucid on 2016-12-21 21:19:56
MailArchivePlugin: Bump version to 1.1
(see #13005)
16134 by rjollos on 2016-12-21 19:58:34
MailArchivePlugin: tag version 1.0

Version 1.0 is compatible with Trac 1.0.

Refs #13005.



Author: lucid
Maintainer: lucid

Last modified 7 months ago Last modified on Dec 21, 2016, 9:30:55 PM

Attachments (2)

Download all attachments as: .zip