|Version 2 (modified by lucid, 3 years ago) (diff)|
Email archive for storing emails in Trac
This plugin adds a new main menu item Mail Archive that can be used to browse and view archived emails and email attachments.
- Import emails to Trac's database from an IMAP account
- A new mailarchive resource realm
- mailarchive: wiki links (plus mail:, email:, and emailarchive: synonyms)
- [[MailQuery(searchterm)]] macro
- New trac-admin mailarchive fetch command
- New Trac permission MAIL_ARCHIVE_VIEW
- Trac Search integration
If you have any issues, create a new ticket.
Download the zipped source from here.
Installation of the plugin requires the usual step, e.g. easy_install http://trac-hacks.org/svn/mailarchiveplugin/trunk and enable it in Trac's plugin admin page or by adding mailarchive = enabled to the [components] section in trac.ini.
A database upgrade will be required as usual (trac-admin path-to-your-trac-environment upgrade).
Assign the new MAIL_ARCHIVE_VIEW permission to the appropriate Trac groups / users (e.g. 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. email@example.com) 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 (e.g. using a cron job in Unix, or using a scheduled task in Windows) it to be periodically called. Replace <host>, <username> and <password> with your email host, username and password.
Example: Schedule a task to call the following command every 15 minutes: trac-admin path-to-your-trac-environment mailarchive fetch imap.example.com firstname.lastname@example.org password123
Make sure that the emails to be archived are marked as unseen / unread (or very recent, i.e. from today) as only such mails will be considered for archiving.
- 13857 by lucid on 2014-04-18 12:04:15
MailArchivePlugin: Implement support for format=table in the MailQuery() macro and make this the default.
(Get the previous simpler format using format=list.)
- 13856 by lucid on 2014-04-18 12:00:11
MailArchivePlugin: Fix for problematic emails with base64 encoded attachments in message/rfc822 parts.
Apparently such emails are a known source of problems:
"message/rfc822" with "base64" encoding from Outlook users via GMail commercial accounts.
Suggests that this is an invalid(?) email.
RFC 2046 section 5.2.1 has this to say about message/rfc822:
No encoding other than "7bit", "8bit", or "binary" is permitted for
the body of a "message/rfc822" entity. The message header fields are
always US-ASCII in any case, and data within the body can still be
encoded, in which case the Content-Transfer-Encoding header field in
the encapsulated message will reflect this. Non-US-ASCII text in the
headers of an encapsulated message can be specified using the
mechanisms described in RFC 2047.
Such broken emails contain something like this:
... Content-Type: message/rfc822; name=Forwarded message Content-Disposition: attachment; filename=Forwarded message Content-Transfer-Encoding: base64 [base64 encoded attachment] ...
But Python's email.message.Message.walk() sees this as two separate parts:
- The message/rfc822 part WITHOUT payload.
- The payload as text/plain. (So it skips the needed base64 decoding when calling get_payload(decode=True).)
We ended up displaying the undecoded attachment as the message for such emails instead of the actual text/plain part.
Fix: Show the first text/plain part and definitely not the misparsed base64 encoded attachment message/rfc822 part.
Also we failed for such attachments because part.get_payload(decode=True) returns None in: add_attachment(part.get_payload(decode=True), ...
For now we still don't import such attachments, but we detect them.
- 13627 by lucid on 2014-02-01 21:12:33
MailArchivePlugin: First release