procmail
[Top] [All Lists]

Re: formail not working !!

2002-12-26 12:56:43
On 26 Dec, Nagib Abi Fadel wrote:
| Hi, i've wrote the following recipe in order to
| prevent delivery of mails when they exceed MAXSIZE,
| but formail is not returning a failure delivery
| message for the sender.
| 
| Here's the recipe (written for testing purposes):
| 
| MAXSIZE=10000
| BOXSIZE=9999
| 
| :0
| * $ $MAXSIZE^0
| * $ -$BOXSIZE^0
| {
|     :0
|     * > $=
|         {
|         :0 h
|         * ! ^Subject.*mail delivery failure
|         | (formail -r -I "From: manager(_at_)elbarid(_dot_)net" \
|                         -I "Subject: mail delivery
| failure"; \
|                         echo "Mailbox full") |
| $SENDMAIL -t
| 
|         :0 E
|         /dev/null
|         }
| }
| 
| :0 Eh
| * ! ^Subject.*mail delivery failure
|| (formail -r -I "From: manager(_at_)elbarid(_dot_)net" \
|                         -I "Subject: mail delivery
| failure"; \
|                         echo "Mailbox full") |
| $SENDMAIL -t
| 
| :0 E
| /dev/null
| 
| 
| /****************************************************/
| /****************************************************/
| Here's my procmailrc:
| 
| SHELL=/bin/sh
| SENDMAIL=/usr/lib/sendmail
| PMDIR=/etc/Procmail
| LOGFILE=$PMDIR/log
| verbose=yes
| MAILDIR=$HOME
| INCLUDERC=$PMDIR/rc.mail_limitation
| /**********************************************/
| /**********************************************/
| 
| and here's the log of a test message:
| 
| >From momo(_at_)elbarid(_dot_)net  Thu Dec 26 20:06:29 2002
|  Subject: hello
|   Folder:  (formail -r -I "From: manager(_at_)elbarid(_dot_)net"
| \                     775
| >From root  Thu Dec 26 20:06:29 2002
|  Subject: mail delivery failure
|   Folder: /dev/null          
 
Unless you have your own verbose variable (lower case) to customize
verbosity, verbose=yes isn't doing anything.  If I'm looking at this
correctly, and if you had VERBOSE=yes, the log file would show the
delivery failure message being generated and sent.  Then when it comes
back in to momo(_at_)elbarid(_dot_)net it passes through the same recipe, fails
the "! ^Subject.*mail delivery failure" condition and is delivered to
/dev/null in the following E(lse) recipe.  I think that explains the
two LOGABSTRACT entries from your logfile.

To test the theory, change /dev/null on the E(lse) recipe within the
braces to $DEFAULT.  I think you'll see it is doing exactly what you
told it to.

Some unsolicited advice... There is no testing to make sure DAEMON
messages are not bounced.  That's not good.  There is no loop
detection. Although your testing of the Subject: probably effectively
works as such, it is too "loose" and could cause problems.  Since you're
generating the Subject:, you know what it is and can match it exactly
(or maybe allow for Re:) instead of using a regular expression that
could match others that are similar.  If it were me, I'd use an X-Loop:
header for loop detection and then the Subject:, Re: in the Subject:,
etc. shouldn't matter.

-- 
Email address in From: header is valid  * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting



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