
Zhiliang Hu <hu@genome.ansci.iastate.edu> writes:
I have a rc.local.00 recipe modified from Rob Lingelbach <rob@alegria.com> to catch multipart/html/coded/... mails which has been working well for quite a while. Recently I noticed some mails sneaked through my list. I checked everything and could not find a clue. I attach the log error and a sample of the rc below and hope some of you could spot some syntex error that is obvious to you but not to me ;-) ... procmail: Error while writing to " formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest) | \ $SENDMAIL -t " ... :0 | formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest)|\ $SENDMAIL -t }
procmail doesn't like it if it gets a write error when feeding the message into an action. This will happen if the action doesn't read in the entire message by more than what is buffered by the kernel. formail, when given the -r flag and not the -k flag doesn't want or need the body, so it will stop reading its input once it hits the blank line that terminates the header. Since nothing in the rest of the action above reads the rest of the data from procmail (i.e., the body) procmail will get a write error if the body won't fit inside the kernel pipe buffers. The solution, of course, is to put the 'h' flag on the recipe, so that procmail will only write the header to the pipe. There's also no need to call cat twice: :0 h | ( formail -r -i "From: $listreq" -A"X-Loop: $listaddr"; \ cat info/reject.attach $tmprequest \ ) | $SENDMAIL $SENDMAILFLAGS -t The same goes for the other invocation of formail with the -r flag. Philip Guenther