Maildrop

maildrop is a mail delivery agent with filtering abilities.

In DreamHost you can use it as a mail filter, replacing procmail.

Prerequisites
In DreamHost maildrop is only installed on the mail servers, not on the web servers to which you have shell access. You can still use it to filter incoming mail, since your home directory (and hence, your Maildir) are mounted on your mail server. The only caveat is that you have to use the $HOME shell variable to refer to your home directory, since it is mounted differently in the mail server than it is in your web server. That is, when you refer to $HOME from your shell, and when the mail server delivering mail to you refers to $HOME, both refer to the same physical location, however, the pathname is different (since both servers mount users' home directories in different mountpoints).

If you blindly trust your maildrop scripting abilities, you can go straight to but, since you are not able to manually run maildrop, you won't be able to test how it is working.

Otherwise, keep reading in order to compile and install your own version of maildrop.

The other advantage of compiling and installing maildrop in your web server is that you can invoke it from web scripts or from Fetchmail.

Unix account setup
You have to prepare your shell account as shown in unix account setup.

Installing pcre
You also need the PCRE - Perl Compatible Regular Expressions library in order to compile maildrop.

cd ${HOME}/soft PCREVERS=8.02 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCREVERS}.tar.bz2 tar xvjf pcre-${PCREVERS}.tar.bz2 cd pcre-${PCREVERS} ./configure --prefix ${RUN} make make check make install After  verify that all tests passed... otherwise, check the error messages and see if you can find out what went wrong.
 * Download and open the latest version of PCRE (the example will use version 8.02, current as of Jun 2010).
 * Configure, compile and install (remember that your environment must be set exactly as explained in unix account setup or else you'll have to change some of the options).

Now the PCRE library is installed in, its header files in  , a couple of utilities in   and the man pages distributed under.

Installing maildrop
cd ${HOME}/soft MDROPVERS=2.5.0 wget http://downloads.sourceforge.net/project/courier/maildrop/${MDROPVERS}/maildrop-${MDROPVERS}.tar.bz2
 * Download and open the latest version of maildrop (the example will use version 2.5.0, current as of Jun 2010).

tar xvjf maildrop-${MDROPVERS}.tar.bz2 cd maildrop-${MDROPVERS} ./configure --prefix ${RUN} --with-etcdir=${RUN}/etc \ --enable-trusted-users=102 --disable-authlib \ --disable-syslog \ CPPFLAGS="-I${RUN}/include" LDFLAGS="-L${RUN}/lib" make make install-strip make install-man
 * Configure, compile and install.

Filtering mail with maildrop
Create a file with filtering instructions documented in http://www.courier-mta.org/maildrop/maildropfilter.html in your home directory called .mailfilter and test it manually using: maildrop $HOME/.mailfilter Once it works to your liking, add a file named .forward.postfix with one line like the following: "| maildrop $HOME/.mailfilter " And then make them only available to you using the following command: chmod 0600 $HOME/.forward.postfix chmod 0600 $HOME/.mailfilter since, otherwise, the mail server (and maildrop) will not run it (and the mail will bounce).

After doing this, send yourself a message and verify that it gets through.