Subject: Re: sinking mail to /dev/null vs. DELIVERED=yes?

From: [email-masked] (David W. Tamkin)
Date: Wed, 1 Mar 1995 14:09:17 -0600 (CST)

Alan Stebbens asked,

| A)  Is it more efficient to do this:
|
|       DELIVERED=yes
|
|     than a "/dev/null" sink recipe, as below?
|
|         :0
|       /dev/null

I believe that DELIVERED=yes would NOT sink mail; it makes procmail tell
sendmail that the letter was delivered but does not tell procmail to drop
the letter.  A mismatching HOST assignment is the fastest way to do that,
provided that there are no more rcfiles on procmail's command line.
Otherwise (remember the thread I started with the subject line
LOSE.MAIL.FAST?) one might as well save to /dev/null.  Even that can be sped
up, though, by using the `h' flag to make procmail drop the body, which is
likely to be the longer portion, and write only the head.  (If you know that
the mail you're throwing out usually has short bodies, use the `b' flag
instead.)

|     or, more simply:
|
|       /dev/null

That will just cause an error.

| B)  When a write error occurs on a specific maildrop, is there a more
|     general solution than placing multiple error recipes after each
|     attemped maildrop?  Again, is there a way to TRAP errors?

The only suggestion I have for that (and it's one I should use myself to
make my rcfile saner) is to use INCLUDERC for repeated code.  For example,
put this into $HOME/.safetyrc:

      :0:
      $BOX
      :0:
      $DEFAULT
      :0:
      $FAILDROP

You don't need the `e' flags because procmail will get past the save to $BOX
only on an error anyway.  If you don't use $FAILDROP anywhere else, you could
remove the assignment of FAILDROP and refer to it in .safetyrc by its literal
name (full path or path from $MAILDIR).  [In Alan's variable-rich scripting
style, he's less likely to remove a variable than to add one and set
SAFETYRC=$HOME/.safetyrc at the top of his .procmailrc and refer to it as
$SAFETYRC, but that works equally well and it's his rcfile.]

|     Here is a selection from my ~/.procmailrc:
|
|     # Detect loops right away -- and stop them
|     :0:
|     * $ ^X-Loop: *$MY_ADDR
|     $INBOX
|       :0e:
|       $DEFAULT
|           :0e:
|           $FAILDROP

      :0:
      * $ ^X-Loop: *$MY_ADDR
      { BOX=$INBOX INCLUDERC=$HOME/.safetyrc }

It's mostly a matter of taste; do you like that any better?

|       # If the mail is directly to me, -> +inbox
|       :0:
|       * $ $TO(aks)([,@]|$)
|       $INBOX
|           :0e:
|           $DEFAULT
|               :0e:
|               $FAILDROP

        :0: # I like the condition better like this:
        * $ ${TO}aks\>
        { BOX=$INBOX INCLUDERC=$HOME/.safetyrc }

|       # If the mail is to an administrative alias, -> +admin
|       :0:
|       * $ ^TO($REQUEST|$STAFF)$POST_ADDR_SPAN
|       $ADMIN
|           :0e:
|           $DEFAULT
|               :0e:
|               $FAILDROP

        :0:
        * $ ^TO($REQUEST|$STAFF)$POST_ADDR_SPAN
        { BOX=$ADMIN INCLUDERC=$HOME/.safetyrc }

|       # Otherwise drop it all in default personal box
|       :0:
|       $INBOX
|           :0e:
|           $DEFAULT
|               :0e:
|               $FAILDROP

Since that one is unconditional (at that point; I realize it's deep inside
braces),

        BOX=$INBOX INCLUDERC=$HOME/.safetyrc

|     :0:
|     * ^TO(hostmaster@)
|     $ADMIN
|       :0e:
|       $DEFAULT
|           :0e:
|           $FAILDROP

      :0
      * ^TOhostmaster@
      { BOX=$ADMIN INCLUDERC=$HOME/.safetyrc }

David W. Tamkin  Box 3284  Skokie, Illinois  60076-6284
[email-masked]    MCI Mail: 426-1818   +1 312 714 5610