Managing the mail queue for forums and blogs

This post was written by stephen on August 21, 2008
Posted Under: Linux

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
Tags: ,

Add a Comment

required, use real name
required, will not be published
optional, your blog address