procmail
[Top] [All Lists]

Re: bounces and +suffixes

2000-06-19 22:46:57
Kragen Sitaker asked,

| Two questions.
|
| I have a recipe
| :0
| * ^Subject:.*mash this
| |/home/kragen/bin/mash
|
| mash is a Perl script which executes the contents of the email as a
| shell script (given correct one-time passwords in the email).  Various
| things can go wrong in mash: full disk, can't fork, etc.  In these
| cases, I would like procmail to exit with code 70 or something similar,
| causing sendmail to bounce the mail.

If there are no more rcfiles named on procmail's command line,

  :0w
  * ^Subject:.*mash this
  |/home/kragen/bin/mash
   :0e
   { EXITCODE=70 HOST }

If there are (highly unlikely),

  :0w
  * ^Subject:.*mash this
  |/home/kragen/bin/mash
   :0e
   { 
    EXITCODE=70
    :0
    /dev/null
   }

| My other question is related: sendmail happily delivers mail to
| kragen+garbage or kragen+walnuts using my .forward file, invoking
| procmail.  However, it doesn't seem that "garbage" or "walnuts" gets
| passed to procmail.  Is there a way to get that information, short of
| installing procmail as the local MDA?

See if your sendmail.cf's path for .forward files supports ~/.forward+suffix
(it may say something like  .forward+$z  I think).  Then you can have, in
~/.forward+garbage,

  "|exec /path/to/procmail -a garbage"

or whatever, and in ~/.forward+walnuts,

  "|exec /path/to/procmail -a walnuts"

Then, near the top of your .procmailrc,

  ARG=${1-NOARG}

and later in the rcfile you can check the contents of $ARG to see if it's
"walnuts" or "garbage" or whatnot.  It's not as flexible as qmail, because
you have to prepare for each specific suffix you want to honor by setting
up a .forward+suffix file, and since those files have no way of knowing their
own names you cannot simply make a master one and just link it to multiple
names (the way a shell script can be linked to several names and check $0 to
see which one it was called by); you actually need separate files for them. 
With qmail you can just set up your .qmail and .qmail-default as links to one
file that contains

  |preline /path/to/procmail

and then your .procmailrc checks the Delivered-To: line added by preline to
see what the suffix was (or to see that there was no suffix):

  SUFFIX
  :0 # use only highest (newest) Delivered-To: line if there are more than one
  * ^Delivered-To: \/[^(_at_)]+
  * $ MATCH ?? ^^$LOGNAME-\/.+
  { SUFFIX=$MATCH }
 

_______________________________________________
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>