Postfix Mail Queue Manager 
Saturday, 29 September 2012, 00:00 - Tools & more, Postfix Stuff, Mail stuff

Description


This PHP script shows the content of the mail queues of multiple servers and give you the possibility to hold, release, delete and reqeue single messages.

If you install a tiny wrapper script on mail servers, you may even remove or requeue multiple messages from a certain sender.

In addition, you can also requeue all messages (sendmail -q).

Download


Download the gzip'ped tar archive

Prerequisites:


On a web- or intranet accessible host (access protection highly recommended!):
- Web Server with PHP script language support (shell_exec function has to be enabled)
- Key-based SSH access to mail servers for webserver user

On mail servers:
- Postfix
- sudo

Installation


Unpack the archive beneath a webserver document root

Adapt the variables $mailservers and $user to your needs, if you like to use the selection by sender e-mail address feature, configure also variable $wrapper_cmd

Add the following lines to /etc/sudoers on the mail server(s), assuming user admin for login to the mail server(s) (change it to your needs):

admin    ALL=(ALL) NOPASSWD: /usr/sbin/postsuper
admin ALL=(ALL) NOPASSWD: /usr/sbin/postqueue
admin ALL=(ALL) NOPASSWD: /usr/local/bin/mailqueue.sh
(last line only needed for selection by sender address)

If you want to use the selection by e-mail address feature, put mailqueue.sh to some path on the mail server(s) and make it executable, e.g.:
cp mailqueue.sh /usr/local/bin/mailqueue.sh
chmod 755 /usr/local/bin/mailqueue.sh

Try it out using http://yourwebserver/mailqmgr/index.php

Comments

Add Comment
Fill out the form below to add your own comments.









Insert Special:






Moderation is turned on for this blog. Your comment will require the administrators approval before it will be visible.