Qmail-notify
How can I get notifications of email stuck in the queue?
by Tor Willy Austerslått
We set up a heavily modified toaster-like SMTP gateway contraption for a client not too long ago. During the techie briefing afterwards, one microscopic but handy issue came up: notification on mails being stuck in the out queue. Apparently MS Exchange can be set up to do this.
We fixed this by simply installing qmail-notify from ports to run in an hourly cron job.
cd /usr/ports/mail/qmail-notify && make install clean
qmail-notify checks the queue and sends a notification to the sender if a mail have been in the queue for more than n seconds. The default is four hours. The notification contains the sender, recipient and subject from the stuck mail. Attaching the complete original mail is optional.
Nothing further will happen, but the sender will know that his/her mail haven't left the mail server yet. Any action is up to the user. We've had a couple of incidents where the user misspelled the domain on an important mail and didn't realize it until a week later when the mail expired from the queue.
To install, select install_qmail_notify in toaster-watcher.conf and run
toaster_setup.pl -s pre
Once installed, add it to the system crontab:
@hourly /usr/local/bin/qmail-notify -r
The complete list of flags available to qmail-notify:
usage: qmail-notify [flags] -b Copy N bytes from the original message into the notice. (Defaults to entire message) -d Show debugging messages -f Load the bounce response message from a file -m Encode the original message as a MIME attachment -N Don't send messages, just print them out -r Only respond to senders with a domain listed in qmail's rcpthosts -t Send notifications for messages that are at least N seconds old (Defaults to 4 hours) -x Send a copy of the notification to the given recipient -h, --help Display this help and exit