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=”sender@myemail.com”
to=”recipient@myemail.com”
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———————————

  • Share/Bookmark

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply

Blog My Nog | Tech Topics is Digg proof thanks to caching by WP Super Cache