Kenneth Kalmer:
> Hi all
> 
> I've spent a couple of hours Googling the topic before posting, and couldn't
> find anything really useful yet.
> 
> I need a way to save copies of email headers for later analysis, not the
> entire message. Is this possible out the box, with an addon, a separate
> piece of software, or would I have to roll my own?

The solution is built into Postfix.

Give each message a BCC recipient, and route that recipient to
an archive file whose name is dated.

/etc/postfix/main.cf:
    always_bcc = [EMAIL PROTECTED]
    transport_maps = hash:/etc/postfix/transport
    bcc_destination_concurrency_limit = 1
    bcc_destination_recipient_limit = 1

/etc/postfix/transport:
    [EMAIL PROTECTED]   bcc:

/etc/postfix/master.cf:
    bcc      unix  -       n       n       -       1       pipe
        flags=FR user=archive argv=/some/where/save_headers

/some/where/save_headers:
    #!/bin/sh

    outfile=`date +%Y%m%d`
    (echo ""; echo ""; sed '/^$/q) >> /some/where/$outfile

Result is a file named after the date, with headers separated 
by two empty lines.

        Wietse

Reply via email to