procmail
[Top] [All Lists]

sendmail & procmail - recipients

1996-09-15 13:53:33
My administrator and I have been trying to figure this out for some time
now.  Any information that could help us out would be appreciated.

Every user on the server has their own .procmailrc file in their home
directory.

All the individual .forward files looks like this:

"|IFS=' ' && exec /usr/local/bin/procmail -f- || exit 75 #jspewak"

This successfully executes procmail with the individual user's .procmailrc
file (username 'jspewak' in this case).  Everything works great, except...

Say someone sends a mail:

To: user1(_at_)JonSpewak(_dot_)com, user2(_at_)JonSpewak(_dot_)com
BCC: user3(_at_)JonSpewak(_dot_)com

My personal .procmailrc file does certain things, depending on which
username the mail was sent to:

:0
* ^TOuser1(_at_)jonspewak(_dot_)com
! <forward to somewhere else>

:0
* ^TOuser2(_at_)jonspewak(_dot_)com
| <execute some command>

:0
* ^TOuser3(_at_)jonspewak(_dot_)com
| <execute a script to bounce this message>

Now the problem.  With the message header specified above, my .procmailrc
will receive three of the same message.  The first recipe
(^TOuser1(_at_)jonspewak(_dot_)com) will be true for all three messages, even 
though
each message was specifically intended for a different recipient.

Also, the users specified in BCC: will be stripped out before procmail has
a chance to check its recipient;  It will not find 
^TOuser3(_at_)jonspewak(_dot_)com
in any mail with BCC: user3(_at_)jonspewak(_dot_)com

We're trying to figure out how to solve the recipient problem.  Sendmail
does know who the correct recipient should be!  I figured that one of the
following will fix the problem:

1) Have sendmail insert the correct recipient under a new header field.
Examples: add 'X-Envelope-To: user3(_at_)JonSpewak(_dot_)com' or 'X-Recipient:
user3(_at_)JonSpewak(_dot_)com'.  Then procmailrc can look at that header 
instead of ^TO.
2) Have sendmail copy the real recipient into a variable that gets passed
to procmail when executed.  So that procmail can look at $RECIPIENT or $1
or whatever to find out who the correct message recipient should be.  Then
procmailrc can look at the variable instead of ^TO.

Does anyone have any idea of how we can do this?

Keep in mind, I am the user, not the system administrator.  Any information
that you can provide to help me or the admin out, would be greatful!  The
server is Pentium, FreeBSD with procmail v3.11pre4 (1995/10/29).

please cc all replies to procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de

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