procmail
[Top] [All Lists]

Re: E-Mail notification

2000-10-17 11:27:36
"Frank Hanna" <Frank(_dot_)Hanna(_at_)KronachOnline(_dot_)de> writes:
Is it possible to force procmail to send a notification E-Mail to a
certain address every time I get a mail?

procmail should do:

when I receive a new message at my account Test(_at_)Test(_dot_)com it should
send a message with the subject-line to
anotheraddress(_at_)anotherprovider(_dot_)com and "modify" the recipient as
directly send to anotheraddress(_at_)anotherprovider(_dot_)com(_dot_)

Do you really need to modify the To: header field?  If you were
intending on using that to filter the messages at the anotheraddress end
then I would suggest instead filtering on the Return-Path: header field
and then just using the incredibly simple recipe:

        :0 hc
        ! anotheraddress(_at_)anotherprovider(_dot_)com

That'll redirect a copy of the message header to that address.  The only
things that should change are a) there will be more Received: header
fields, and b) the Return-Path: will be the address of the 
Test(_at_)Test(_dot_)com
account.

Now, if you really just want to receive a new message that happens to
have the same Subject: as the one sent to Test(_at_)Test(_dot_)com, that can be
done with this recipe instead:

        :0 hc
        | formail -XSubject: \
                  -I"To: anotheraddress(_at_)anotherprovider(_dot_)com" -XTo: | 
\
          $SENDMAIL $SENDMAILFLAGS -t

The formail command extracts the Subject: header field from the incoming
message and adds a To: header, which is then fed into sendmail, the -t
option telling sendmail to extract the recipients from the message
itself.  Note that you need the -XTo: option for formail as otherwise it
won't extract to its output the (newly added/changed) To: header field.

In both of the above recipes, the 'c' flag on the recipe itself tells
procmail to do this with a copy of the message, so it'll keep processing
the message locally.  The 'h' flag tells procmail to only feed the
message header into the specified command instead of the entire message
as is default.


Philip Guenther

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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