[Mimedefang] Writing to an MBOX file
Damrose, Mark
mdamrose at elgin.edu
Tue Mar 21 11:47:28 EST 2006
> -----Original Message-----
> From: Kenneth Porter
> --On Tuesday, March 21, 2006 2:17 PM +0100 Steffen Kaiser
> <skmimedefang at smail.inf.fh-bonn-rhein-sieg.de> wrote:
> > during filter_begin() or filter_end(), you'll have a local file
> > './ENTIRE_MESSAGE' holding the entire message. Append a newline, a
> > "From $Sender\n" and the content of that file to your mbox file.
> > However, read about mbox locking, if you want to read that
> mailbox, simultaneously.
ENTIRE_MESSAGE is what you get when you quarantine, during processing
it's ./INPUTMSG.
> I think the From line needs a little bit more info. I ran
> into problems with a Mailman archive when I fed it to
> Dovecot, my IMAP server, because it didn't like the
> abbreviated From line. It thought the whole file was one big
> message. Looking at one of my mbox files, it appears that a
> datestamp is needed on the end of the line.
If you're going to write it yourself, you also need to worry
about From_ quoting.
See http://www.qmail.org/man/man5/mbox.html
and http://homepages.tesco.net./~J.deBoynePollard/FGA/mail-mbox-formats.html
There are also several packages on CPAN for doing mbox reading/writing.
You may also want to see if maildir format could work for you. It
would be much easier to write. Copy ./INPUTMSG to the maildir directory as
a unique filename and prepend Return-path and Delivered-to headers.
More information about the MIMEDefang
mailing list