Managing the mail queue for forums and blogs

I administrate several forum and blog sites and was in need of a quick and reliable method to monitor and manage the mail queue. My desire was to implement a system that would keep me up to date on the status of my server’s mail queue via a daily cron job. This is something that can easily be forgotten about if one is as busy as I am and this very simple script lets me know if I have any e-mails jammed up in the local mail queue.


Sponsors, article continues below...

Feel free to change the variables to your liking and add it to your daily or weekly cron job.
———————————START COPY———————————
#!/bin/sh

file=”/home/user/mailq.txt”
from=”[email protected]
to=”[email protected]
subject=”Mail Queue Status”

echo “to: ” $to>$file
echo “subject: “>>$file
echo “from: ” $from>>$file
echo “”>>$file
/usr/bin/mailq>>$file

/usr/sbin/sendmail -t <$file
———————————END COPY———————————

This entry was posted in Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *

*