Many thanks to everyone who replied.
I've fixed the problem in the following manner.
1 Edit the /etc/mail/sendmail.cf file to change the Delivery Mode
variable (Od) from background mode to queue mode (Odb to Odq).
2 Edit the /etc/init.d/sendmail file to run sendmail -bd rather than
sendmail -bd -q1h
3 Stop and start sendmail
Now all messages will be sent to /var/spool/mqueue and not send until
sendmail -q -oQ/var/spool/mqueue is run.
You can now write a script to perform whatever filtering you want on the
q (header) and d (body) files stored in /var/spool/mqueue. At the end of
the script call sendmail -q -oQ/var/spool/mqueue and the remaining
messages will be sent. This is best run from cron, although make sure
that the interval between each run is longer than it takes for the
script to complete. Otherwise you'll get into all sorts of trouble.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:46 CDT