I need a mail archiving tool that

  • can connect to an IMAP server (port 25 / TLS)
  • can fetch incoming and outgoing emails (certain folders)
  • batch save them to disk as HTML
  • with a configurable filename pattern, which can include

    • sender
    • receiver
    • subject
    • date / time
  • also saves attachments.

A GUI is not mandatory.

1 Answer 1


Judging from the title (i.e. ignoring the "windows" tag and the "port 25" you want to connect to), I'd recommend either Archivemail or offlineimap.

You can read about Archivemail in it's man page. From the synopsis:

archivemail is a tool for archiving and compressing old email in mailboxes. By default it will read the mailbox MAILBOX, moving messages that are older that the specified number of days (180 by default) to a mbox(5)-format mailbox in the same directory that is compressed with gzip(1). It can also just delete old email rather than archive it.

archivemail supports reading IMAP, Maildir, MH and mbox-format mailboxes, but always writes mbox-format archives.

I am tempted to say that offlineimap (man page) is a bit more powerful, but that depends on your needs.

OfflineImap operates on a REMOTE and a LOCAL repository and synchronizes emails between them, so that you can read the same mailbox from multiple computers. The REMOTE repository is some IMAP server, while LOCAL can be either a local Maildir or another IMAP server.

I don't think any of those can save every mail with a filename pattern you desire, but with maildir every email is a file and you could open every file, extract the desired information and rename the file. That sounds like a hundred lines of Python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.