Showing results for 
Search instead for 
Did you mean: 

Automating sendmail

Jose M. del Rio
Frequent Advisor

Automating sendmail

because of security reasons, I would like to check every message arriving to sendmail to be relayed, in order to verify whether it has been sent with Outlook.
I've noticed Outlook uses the X-Mailer extension field to record its name and version (e.g. X-Mailer: Microsoft Outlook IMO, Build 9.0.2416), so I would like sendmail to append the header of every new message to a file, or to execute some script every time a new message arrives, etc.
In our usual configuration, sendmail works in background daemon mode (DeliveryMode=background) so every new message is relayed as soon as it arrives.
Putting it into queue mode with a queue check interval of, let's say 6 minutes (-q6m) and crontabbing a script to grep /var/spool/mqueue/qf* files every 5 minutes works fine but I would like to know if there is a simpler solution.
Thanks a lot.
Robin Wakefield
Honored Contributor

Re: Automating sendmail


I have do to something similar with every message. sendmail runs in queueonly mode, and I have a separate perl script runs which processes each message and moves it to a different queue directory. The script tries to send the message immediately it's been processed, otherwise a cronjob processes the queue every 10 minutes. The perl script forks multiple copies of itself for speed.

Rgds, Robin