I'm trying to write a procmail recipe that, when it receives mail
to me (rsr) of the form rsr+<foo>, will
A) If <foo> is one of a small number of keywords, do something
specific (for example, rsr+pgp will send my public key).
B) Otherwise, forward the mail to <foo>
If procmail is your local delivery agent, listed in the local mailer
definition in your sendmail.cf, then the <foo> information should be
passed to procmail via the -a flag, and your .procmailrc can access it
via $1. You can then assign it to a variable and check its value using
the "var ??" condition special. For example:
ARG = $1
XLOOP = rsr(_at_)your-machine(_dot_)where(_dot_)ever
# If this is a loop, deliver it to $DEFAULT now to prevent loops.
* $ ^X-Loop: $\XLOOP
* ARG ?? ^^pgp^^
|(formail -rt -A"X-Loop: $XLOOP" -I"Subject: my pgp key"; \
cat $HOME/.pgp/extracted-key \
) | $SENDMAIL $SENDMAILFLAGS -t
# ... more special cases here
# If it's not a special case, forward to the part after the plus.
# The "--" keep someone from slipping an argument to sendmail
# by mailing to, say, <rsr+-bs(_at_)your-machine(_dot_)where(_dot_)ever>
! -- "$ARG"
If that doesn't work, then you you should check your sendmail
configuration, upgrading to a newer sendmail and sendmail.cf in