Maildrop

Maildrop is a mail filter/delivery agent that can be used with your Qmail server to customize how messages are handled as they are delivered. One capability is to have messages moved to a particular IMAP folder as they are delivered to the user's mailbox.

Prerequisites
Maildrop requires PCRE to be installed:

cd /extra/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar zxvf pcre-8.37.tar.gz
cd pcre-8.37
./configure --enable-utf8
make
make install

Version 2.8.1 requires the Courier Unicode Library

cd /extra/src
wget http://iweb.dl.sourceforge.net/project/courier/courier-unicode/1.3/courier-unicode-1.3.tar.bz2
tar jxf courier-unicode-1.3.tar.bz2
cd courier-unicode-1.3
./configure
make
make install

You also need to add the library files to LD_LIBRARY_PATH:

echo "/usr/local/lib" > /etc/ld.so.conf.d/locallibs.conf
ldconfig

Maildrop installation
Install the gdbm-devel package:

yum -y install gdbm-devel

Then download and install maildrop:

cd /extra/src
wget http://iweb.dl.sourceforge.net/project/courier/maildrop/2.8.3/maildrop-2.8.3.tar.bz2
tar jxvf maildrop-2.8.3.tar.bz2
cd maildrop-2.8.3
./configure --enable-maildrop-uid=vpopmail --enable-maildrop-gid=vchkpw
make
make install-strip

Maildrop Logging
Patrick McDonald came up with a good way of setting up Maildrop's logging to use multilog. His Maildrop with multilog page details the installation as well as why he did it this way:

Maildrop provides a logging functionality. This functionality allows you to log what actions maildrop is taking with your messages and where you want it to write. There are a couple of problems with the maildrop logging functionality. First, there is no means to limit the size of the log file. This means the logfile could grow to fill the partition and/or filesystem. Second, it does not possess the ability to rotate files by criteria. Programs such as logrotate while capable of handling these problem, do not posses an automatic restart capability and are not OS agnostic.

Patrick's method requires creating a logger service using a named pipe and having maildrop log to the named pipe. For the purposes of this example, the named pipe will be "/tmp/log-maildrop". To create the maildrop-logger service:

mkdir -m 1755 /var/service/maildrop-logger
mkdir -m 755 /var/service/maildrop-logger/log
cd /var/service/maildrop-logger/log
wget -c --no-check-certificate http://www.antagonism.org/scripts/log-run
mv log-run run
chmod 755 run
cd ..
wget -c --no-check-certificate http://www.antagonism.org/scripts/log-maildrop
wget -c --no-check-certificate http://www.antagonism.org/scripts/pipe-watcher
wget -c --no-check-certificate http://www.antagonism.org/scripts/maildrop-logger-run
mv maildrop-logger-run run
chmod 755 pipe-watcher log-maildrop run

Create the symbolic link to start the service:

ln -s /var/service/maildrop-logger /service

Wait about 10 seconds then confirm that the service is running:

svstat /service/maildrop-logger

To really confirm that it is running, in one shell window, watch the maildrop-logger log file:

tail -f /service/maildrop-logger/log/main/current

In another shell window, echo some text onto the named pipe /tmp/log-maildrop. You should see the text in the service log:

echo testing > /tmp/log-maildrop

Credits

Various bits of code, scripts, and procedures were put together with information from John Simpson's qmail.jms1.net website. It's an excellent resource on managing and setting up a Qmail server.

Recent Updates

  • 2 years 1 week ago
  • 2 years 1 week ago
  • 2 years 1 week ago
    php 8.x
  • 2 years 1 week ago
    10.6.7
  • 2 years 1 week ago
    Drop Centos 5/6 stuff