I wasn't paying much attention to this thread, but Rob has this code,
:0w
{
# Grab the entire header for the body of the message
# Grab the Virus name for the Subject line.
HEADER = `formail -X "" `
VIRUS = `formail -xX-ClamAV`
:0
| ( echo "From: Postmaster(_at_)dympna(_dot_)com"; \
echo "To: $LOGNAME(_at_)dympna(_dot_)com"; \
echo "Subject: ** Virus eMail with $VIRUS"; \
echo "No auto-reply was sent to the originator of this virus";\
echo "infected email. You may with to contact the person in";\
echo "the >From: line below."; \
echo " ";\
echo "Following are the headers that were extracted from the
email:";\
echo " ";\
echo "$HEADER" ) | $SENDMAIL -oi -t
}
and he gets,
procmail: Error while writing to " ( echo "From:
postmaster(_at_)dympna(_dot_)com"; \
Well, of course. The action of that recipe echoes a bunch of canned
lines to a pipe to sendmail; it doesn't read the message text at all.
So when it doesn't read it, procmail can't write it, and there's a write
error. If you intentionally are writing an action line that won't read
the message in, use the `i' flag to tell procmail that write errors are
OK for a change.
Scott thought,
I think the error is coming from sendmail.
No, it's a procmail error. It should be listed in the procmailrc(5) man
page [or maybe procmail(1); I can't check right now].
Also (a nit) I don't see a filter anywhere, so the 'w' flag at the top
probably isn't necessary. You'll usually see it in conjunction with
'f' (procmailrc).
`w' does not make sense on a recipe whose action is to open a nesting
block unless it also has a `c' to fork a clone. So if Scott's point is
that `w' is unnecessary, it is, but not because there's no `f'.
Scott also advised Rob,
You might consider using formail (see the formail manpage) for
generating your headers; it will be less work and probably more RFC
correct.
Rob's header generating method is fine as it is. I wouldn't recommend
it for a reply, but for an additional message to the recipient it's
probably preferable to starting with the incoming headers and running
them through formail, given all the alteration formail would need to do.
A shell is being invoked anyway to handle the semicolons and the pipe,
and presumablye Rob's shell has echo built in, so there's less load with
just a shell and $SENDMAIL than with formail, a shell, and $SENDMAIL.
What *is* missing is a `c' on the recipe that sends the warning note.
The only reason procmail isn't exiting there but manages to save the
original message to $VIRUS_FOLDER is that it senses the very write error
that is annoying Rob!
So leave your code as is, except to add `ci' to the flag line of the
recipe that sends the warning note. Alternatively, put the save to
$VIRUS_FOLDER first (with a `c') and then drop in the warning note (but
use the `i' flag). You could also set $TRAP to take care of it.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail