procmail
[Top] [All Lists]

Re: How do I capture the value of the TO header in my procmail log?

2008-06-23 13:15:28
On Mon, June 23, 2008 2:59 pm, Dale W. Neumann wrote:
On Mon, 23 Jun 2008, R.G. Ball wrote:
Are you sure it is only the To: field that is of interest? Could those
accounts get messages via the Cc: or Bcc: fields? If no then use
something
like what Birl posted. If yes then you'll need to coerce the MTA
(sendmail, postfix, etc.) to include the envelope information as a
header
in the message so you can extract it from the forwarded messages.

How would I go about doing that?

Highly dependent on what system you are running and how it is configured.

Let's assume postfix:

configure postfix's main.cf to have
  mailbox_command = /path/to/procmail -a "$USER"

($USER is the recipient's username)

then in the system-wide procmail rcfile (or the individual's) you'll need
to use formail to add an X-envelope-to: header with the username,
something like

:0wf
* ! X-envelope-to:
  | formail -i"X-envelope-to: $1"

Now, when those messages get forwarded to your account you'll need to have
your local .procmailrc script look for the X-envelope-to header and
extract the username.

(none of the above is tested and is subject to modification to make it work)

Rich

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>