Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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