Subject: How to log the header fields?

From: [email-masked]
Date: Thu, 19 Jan 95 19:59:09 EST

Greetings!

I'd like to do the following:

1. Log date, time, address, subject of each e-mail message to a file.
2. Pass the subject of the message to a script.

How can I do it with Procmail?
Thanks.

Anu

---

From: [email-masked] (David W. Tamkin)
Date: Thu, 19 Jan 1995 23:20:10 -0600 (CST)

| I'd like to do the following:
| 
| 1. Log date, time, address, subject of each e-mail message to a file.
| 2. Pass the subject of the message to a script.
| 
| How can I do it with Procmail?

1. If you've defined a logfile and have not set LOGABSTRACT to `no' or `off'
or `false', procmail will automatically log the From_ line, the Subject:
header, and the final disposition.  The From_ line contains the date and
time of arrival.  If you also want the date and time the letter was sent,

  TRAP='formail -XDate:'

in your .procmailrc will record that.

2. That isn't much detail, but if you want the subject to be the script's
standard input,

   :0c flags
   * conditions
   | formail -x Subject: | /path/to/script

or if the script needs to receive the words of the subject as positional
parameters,

   :0c flags
   * conditions
   | /path/to/script `formail -x Subject:`

or if the script needs to be told the entire subject as its $1,

   :0c flags
   * conditions
   | /path/to/script "`formail -zx Subject:`"

though I get the feeling that none of those will work because of something
else about the script or about the way it will be used.