procmail
[Top] [All Lists]

Re: procmail receipe

1997-08-28 18:15:15
Omar Keblawi -MITS <keblawi(_at_)Cadence(_dot_)COM> writes:
The Original problem:  Given a hundred users who email addresses have 
moved from one company to another. ie user(_at_)A(_dot_)com to 
user(_at_)B(_dot_)com(_dot_)
I needed to forward all messages to the new account and do an auto-reply
to the orignator, with an explaination and the new users email address.

So here it is....

How is this supposed to be invoked?  A mailertable entry for A.com?
Or are people who send to user(_at_)B(_dot_)com also getting these messages?


# This gleens the user name from the To: field
# the puts it in the default $MATCH variable 
# to be used later.

:0
* ^To: *\/[^ ].*[^ ]
{ }

Bzzt, you lose.  You just extracted the To: header, when you should
have used the envelope recipient address.  Does no one at your company
get cc'ed, or subscribe to mailing lists?  If this recipe is indeed
located in /etc/procmailrc, then the envelope recipient is conveniently
located in the LOGNAME variable.  If procmail is being called via a
mailertable entry, then $2 is what you want, though you'll need to copy
it from there to a normal variable to do anything with it.


# Sends an auto reply to the user and
# substitutes the users new email address
# for the placeholder in the vacation message.

:0 a
*!^FROM_DAEMON
*!^X-Loop:moveduser(_at_)Cadence(_dot_)COM
| ($FORMAIL -r -i"Precedence: junk" \
       -A"X-Loop: moveduser(_at_)Cadence(_dot_)COM" ; \
       sed "s:user:$MATCH(_at_)Cadence(_dot_)COM:" < $HOME/.vacation.msg \
       ) | /usr/lib/sendmail -t

$HOME?  Then is all mail to A.com being routed to a single account, where
this is being executed?  Choke, barf, vomit, heave...


Philip Guenther

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