Maildir to Unix style mbox
Some tools, like SpamProbe, require your mailbox to be in mbox format.
A while ago I converted my mailboxes to maildir. But especially SpamProbe can only handle unix style mboxes.
Here is a little Python script reading a maildir and putting out mbox format on stdout:
Here is a little Python script reading a maildir and putting out mbox format on stdout:
import sys
import email
from email.Errors import BoundaryError, HeaderParseError
from mailbox import Maildir
maildir = sys.argv[1]
md = Maildir(maildir, email.message_from_file)
while True:
try:
mail = md.next()
except (BoundaryError, HeaderParseError):
continue
if mail is None:
break
print mail.as_string(True)
Last modified 10.02.2004 08:11