advice re mail

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Sep 24 14:28:19 PDT 2003


On Wed, Sep 24, 2003 at 01:55:43PM -0700, David Bear wrote:
> I need to write a program the grabs mail from a standard mail folder
> and processes it.
> 
> The trouble is I have no idea what mail file format FreeBSD uses by
> default.  I am using postfix, and currently postfix is my mta and mda.
> I will be adding procmail as the mda.  I'm guessing procmail writes
> the same kind of file the postfix does... but here I'm showing my
> ignorance.  
> 
> I will be using python as my language and there are modules for MH,
> maildir, mbox, and mailbox...  Anyone have any recommended reading for
> me to better understand what I need to do?

By default FreeBSD uses the Berkeley mbox format.  That's essentially
just concatenating all of the e-mails together into one file, where
each message starts with m/^From / (as a perl style regexp.) and ends
with a blank line.  There are also usually 'Content-Length:', 'Lines:'
and 'Status:' lines added towards the end of the mail headers, but
these are just for the convenience of the MUA.

procmail(1) can write either to mbox style mail boxes, or to maildirs
-- in that case, the mailbox name corresponds to a directory and
individual messages are stored inside it as numbered files.

Since you're installing procmail(1), you'll also get the formail(1)
program, which can do all sorts of tricks with mailboxes.  For
instance:

    % formail -s sh -c 'cat > msg.$FILENO' < mbox

will read the mailbox file, mbox, split it up into individual messages
and write them out as numbered files: msg.000, msg.001, msg.002 etc.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030924/aca4fc92/attachment.bin


More information about the freebsd-questions mailing list