Serverside filter with SquirrelMail


Down load the plugin
Install pre-requisites – squirrelmail compatibility plygin:
cd /usr/port/mail/squirrelmail-compatibility-plugin1/
make install
make clean

Download the ServerSidePlugin from here. And then extract the tarball in the SquirrelMail plugins directory:
cd /usr/local/www/squirrelmail/plugins
tar xvfz ~/serversidefilter-1.42.tar.gz

Rename the config file:
cd serversidefilter
cp config.php.sample config.php

Edit the config file config.php and set the followin:
$FILTER_FILE_PATH = '/home/vpopmail/domains/[DOMAIN]/[USERNAME]/.mailfilter';
$FILTER_APP_PATH = '/usr/local/bin/maildrop';
$LOCAL_MAILDIR = '/home/vpopmail/domains/[DOMAIN]/[USERNAME]/';
$FORWARD_FILE_PATH = "/home/vpopmail/domains/[DOMAIN]/[USERNAME]/";

and un-comment these lines:
//$SPAMFILTER = '/usr/bin/spamc -u [USERNAME] -f';
//$SPAMHEADER = 'X-Spam-Flag';
//$SPAMVALUE = 'Yes';


You need to recompile the filtercmd to work on FreeBSD and your settings.

Read the README in the script directory. Change in the Makefile:
LIBS=-L/usr/local/lib -L/usr/local/lib/compat -lc-client4 -lssl -lpam -lgssapi \
-lcrypt -lkrb5 -lcom_err -lz -lcrypto -lopie -lradius -ltacplus -lutil -lmd -ly\
pclnt -lssh -lasn1 -lroken -lcrypto

Save it.

Install c-client from mail/cclient/ in ports.

Now you should be able to compile but still the script does not work.
I get this problem:
Can’t find uid/gid for user

The problem is that I use vpopmail and thus there exists no users within imap that are system users. I think there might be help here

Sometime in the future when above is solved the rest should be as follows!
Now you are setup!

Go to /usr/local/www/squirrelmail/ and do config/ to configure SquirrelMail to use this new plugin. Select 8 for plugins, then the number for ServerSideFilter. Then press S to save and Q to quit. Go to http://your-squirrelmail-location/src/configtest.php to make sure your configuration is working!

2 thoughts on “Serverside filter with SquirrelMail

  1. I’ve got a FreeBSD Mail Toaster ( that uses Vpopmail and I’m doing some preliminary research into adding server-side filtering to SquirrelMail. Were you ever successful in your hacking with this?

  2. Hi,

    no never got the time to work more on it. Got some other qmail problems I have not yet been able to solve either and they are prio eventhough not very hig atm.


Leave a Reply

Your email address will not be published. Required fields are marked *