procmail
[Top] [All Lists]

Re: procmail receipe

1997-08-29 08:02:42
Philip,

I realize it's not the best, but I'm pretty new at procmail and sendmail.
I didn't use a global /etc/procmailrc file nor a mailertable.  The mailertable
seem pretty powerful, I'll remember that for the future, thanks for the
tip on it.  All I used was on host for company A, was the aliases file.  For 
a given user it would mail to the new user account at company B, as will as
sending it to a local user called "moveduser".  This  "moveduser" account has
a .procmailrc file that mails out a reply message with the new account info.
The aliases file on the system in A.com would be something like this:
user1:  user1(_at_)B(_dot_)com,moveduser
user2:  user2(_at_)B(_dot_)com,moveduser

Then I set up moveduser with a .procmailrc file below.

This whole thing is only temporpal.

Thanks for the info....

Omar



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>