On Sat, 20 Jul 2002, Aleksey Nogin wrote:
Is is possible to get procmail to output something - not to the LOG
file, but to stdout/stderr? I need it to get sendmail to generate a
custom error message when doing a bounce. Currently I have to set up
sendmail to call a special procmail wrapper script instead of calling
procmail directly and the wrapper script does the following:
------
#!/bin/sh
MSG=`mktemp /var/tmp/procmail.wrpr.XXXXXX`
cat - > $MSG
/usr/bin/procmail "$@" < $MSG
EXITVAL=$?
if [ $EXITVAL = 77 ]; then
echo "Your e-mail went through a blacklisted server:"
.../scripts/generate-rbl-details < $MSG
echo ""
echo "Because of that our system decided to reject your e-mail."
echo "If you believe this was a mistake, please resend your
message"
echo 'with "please read" added to the Subject field.'
echo ""
fi
rm -f $MSG
exit $EXITVAL
------
I do not understand why do you need the stderr? I guess that you
want to send a message when you find that "e-mail went through a
blacklisted server". So, why don't you do it instead of set
the $EXITVAL?
:0 fbw
* Does the e-mail went through a blacklisted server ?
| cat /the/message -
But this is pretty ugly - is there a way to do this via procmailrc
without having to modify sendmail.cf and utilize a separate wrapper script?
Try this:
mkfifo /var/log/procmail
Now, /var/log/procmail is not regular file but, named pipe.
Next, run script witch read this pipe in loop and do what ever
you want.
In /etc/procmailrc:
LOGFILE=/var/log/procmail
Nothing changed Ha? (:-)
I did not check it with procmail but I use this trick (for long time)
to filter syslogd messages in Solaris 7 (Sun does not support filters
in syslog.conf. I set the output file /var/adm/messages as named pipe)
(Yes, I know it ugly too)
Bye,
Udi
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail