I want to know how to run a process every time sendmail sends an
email.
I don't want to process the email content, or addresses, just call a
program (like a counter).
Any ideas?
If you want just some mail counter, then use logwatch to check the sendmail
log and you will get a good statistics about howm many mails sent, received,
mail sizes and so on.
--
//Aho
Watching logs are the only way to do this?
Ok...
> Watching logs are the only way to do this?
You might be able to define a new mailer or alter the (e|)smtp mailer(s)
so that they call an external program.
Grant. . . .
> I want to know how to run a process every time sendmail sends an
> email.
You could use a milter. This is more efficient than starting a new
process each time.
(Technically, a milter gets called every time Sendmail *receives* a
message via SMTP, but in many situations this is close enough.)
Regards,
David.
O> I want to know how to run a process every time sendmail sends an
O> email.
O> I don't want to process the email content, or addresses, just call a
O> program (like a counter).
In Unix environment, I use syslog's ability to feed a program or script
with copies of log records written by sendmail. It works just fine,
in syslog.conf I have:
mail.info /var/log/maillog
mail.* |/usr/local/adm/script
So, script obtains every line sendmail writes to the log, so processing
may be as simple as:
#!/bin/sh
# script - /usr/local/adm/script
while read line
do
case "$line" in
*stat=Sent) ... ;; # here you may do what you wish, run a process etc.
esac
done
#EOF
Eugene