Re: err msg in log file from pipe cmd, to notify sender of rejected msg
2005-03-25 08:38:42
At 08:38 2005-03-25 -0600, Mr Duck wrote:
procmail: Error while writing to " (/usr/bin/formail -r -A "X-Loop:
ourdomain.com" ;
[snip]
:0
* > 7000000
* !^FROM_DAEMON
* !^X-Loop: ourdomain.com
{
LOG="Reason: Message over 5meg in size. Refusing
"
:0 c: toolarge.lock
| (/usr/bin/formail -r -A "X-Loop: ourdomain.com" ; \
cat /etc/messagetoobig.txt ) | $SENDMAIL -t -frejection_notice
:0:
/dev/null
}
-E-N-D---------------------
Since you're going to discard the message anyway, remove the 'c' flag (ask
yourself why you'd DELIBERATLEY need to create an additional copy - along
with the added processor load it entails - just so you can toss the
original). Also, since you're not writing to a distinct file (anything
SENDMAIL creates will be serialized anyway), there's absolutely no reason
to use locking on that either. You can either add 'i' to ignore the write
error (explanation follows), or use 'h' to tell procmail only to write the
HEADERS to the output. The flags line on the formail invocation becomes:
:0i
or
:0h
Go ahead and keep the discard rule just after it (if the bounce fails for
some reason, that'll still discard the message), though since you're
writing to the special device /dev/null (and you're DISCARDING it, so
interleaved write operations are hardly a concern), you don't need a
lockfile there either.
The reason you're getting the write error is that formail isn't reading in
the entire message. Procmail is expecting to write the headers and MASSIVE
body, but the invocation of formail is telling it to just process the
headers. See 'man formail' and note the '-k' switch -- it's implcit that
without that switch, your invocation isn't going to involve the body.
Some other reccommendations: if rejection_notice isn't a valid address,
don't set the envelope sender to be that anyway. in fact, you should set
it to be postmaster (which is a better option than mailer-daemon, unless
your bounce message is formulated so as to mimic a 'standard' bounce for
oversized messages). Have you considered just enabling the message size
limits in your MTA?
And, here is the item from 'man procmailex' from which I built this rule:
[snip]
Please note the use of the 'h' flag, which is the HEADER portion on which
formail operates... formail is thus reading all of what is provided to it,
and procmail doesn't register a write error as a result.
Anyone have any ideas why it's erroring on this? Is it due to return
values? Do I need to spec 'w' or 'W', or possibly 'i'? 'W' or 'i' would
seem like a cop-out to me (like putting a bandaid on a gunshot wound)...
'i' is entirely valid here if you don't use 'h' - you're in effect
discarding that MASSIVE body, but procmail is unaware that this is your
INTENT, and formail isn't reading the entire message since in the mode
you're using it, it is operating on the headers only, and it's smart enough
to cease reading the input when the headers are done.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
|
|