procmail
[Top] [All Lists]

Re: How to match on empty body?

1996-12-09 09:35:12
David W. Tamkin writes on 15 October 1996 at 16:00:47
Rick Troxel asked,

| Is there a recipe for detecting messages in which the body is empty?

The best answer I've seen posted so far was from Michael Ghens, but I'd
like to tweak it a little:

 :0Bb
 * ! [!-~]
 /dev/null

So I'm paranoid and don't want to actually send such messages straight
to /dev/null, rather I want to send a short reply back to the person
letting them know that I'm not reading their message (some people have
a nasty habit of writing the entire message in the Subject: line).
With of course the usual cavets of not replying to daemons and other
such things.

Which results in the following:  Can this be improved any?  I already
see I'm using a different regexp...
-----
#####
##### catch blank messages
#####
:0WhcB:$MAILDIR/.blank.lock
* !^FROM_DAEMON
* !^Precedence: ?(bulk|list|junk)
* $!${VACA_SUBJECT}
* ^^[   ]*$
* $!^X-Loop: ${UNIQUE_NAME}
| formail -rD 8192 $MAILDIR/.blank.cache
:0 ehc         # if the name was not in the cache
{
  :0f
  | formail -rt -I "Precedence: junk" -A "X-Loop: ${UNIQUE_NAME}"

  :0bf
  | (echo "Hi!" ;\
  echo "" ;\
  echo "This is just to let me know that the message you just sent" ;\
  echo "to ${TO_LINE} about ${SUBJECT}" ;\
  echo "was empty; and thus has automatically been deleted." ;\
  echo "You may want to double-check to ensure that a mail-related" ;\
  echo "problem did not occur someplace." ;\
  echo "" ;\
  echo "Thanks," ;\
  echo "   Dan" ;\
  cat ${HOME}/.signature )

  :0
  ! -oi -t
 }
:0 a:
toread/blank
-----

   Dan
------------------- message is author's opinion only ------------------
J. Daniel Smith <DanS(_at_)bristol(_dot_)com>        
http://www.bristol.com/~DanS
Bristol Technology B.V.                   +31 33 450 50 50, ...51 (FAX)
Amersfoort, the Netherlands               {info,jobs}(_at_)bristol(_dot_)com

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