Guide On How To Install Qmailadmin On FreeBSD

A step by step guide on how to install Qmailadmin on FreeBSD

Qmailadmin is a web interface for administrating Qmail. You could live without Qmailadmin and use command line options instead and it would work flawlessly. But if you are not familiar with how that works Qmailadmin can make your life easier.

During the installation we’ll patch it with John Simpson’s onchange patch because there is no native support for “onchange”

As root

cd /usr/ports/mail/qmailadmin
make extract
cd work/qmailadmin-1.2.15
fetch http://www.xfiles.dk/files/qmail/qmailadmin-1.2.12-onchange.3.patch
patch < qmailadmin-1.2.12-onchange.3.patch

Yes I know there is a version difference between the patch and the actual version of Qmailadmin. This however is no problem as you can see when applying the patch as it comes out without errors.

You will get an output like the one below.

Output

Hmm… Looks like a unified diff to me…
The text leading up to this was:
————————–
|diff -ruN qmailadmin-1.2.12-factory/autorespond.c qmailadmin-1.2.12-patched/autorespond.c
|— qmailadmin-1.2.12-factory/autorespond.c    2007-09-21 19:27:38.000000000 -0400
|+++ qmailadmin-1.2.12-patched/autorespond.c    2008-12-21 15:55:12.000000000 -0500
————————–
Patching file autorespond.c using Plan A…
Hunk #1 succeeded at 186.
Hmm… The next patch looks like a unified diff to me…
The text leading up to this was:
————————–
|diff -ruN qmailadmin-1.2.12-factory/command.c qmailadmin-1.2.12-patched/command.c
|— qmailadmin-1.2.12-factory/command.c    2007-01-01 18:17:06.000000000 -0500
|+++ qmailadmin-1.2.12-patched/command.c    2008-12-21 15:26:17.000000000 -0500
————————–
Patching file command.c using Plan A…
Hunk #1 succeeded at 309 (offset 3 lines).
Hmm… The next patch looks like a unified diff to me…
The text leading up to this was:
————————–
|diff -ruN qmailadmin-1.2.12-factory/user.c qmailadmin-1.2.12-patched/user.c
|— qmailadmin-1.2.12-factory/user.c    2007-11-03 13:44:12.000000000 -0400
|+++ qmailadmin-1.2.12-patched/user.c    2008-12-21 15:27:57.000000000 -0500
————————–
Patching file user.c using Plan A…
Hunk #1 succeeded at 626 (offset 15 lines).
done

Now we want to compile Qmailadmin with some specific configuration arguments. You should change the “bold” arguments below. That means, change the following

/usr/local/www/cgi-bin” to where your cgi-bin resides
/usr/local/www” to where your www directory resides
/usr/local/www/gfx/qmailimages to where you want to store the Qmailadmin images

The next two arguments has taken me some time to figure out as they are not documented in the makefile. What they do you ask ? Well they determine how many users and forwards the web interface is showing before you need to hit a “next page button”. Now I rather do “scroll down only” than “do scroll down and then hit next” but it’s up to you if not defined the default is 15. Otherwise set it to your needs.

maxusersperpage=50
maxaliasesperpage=50

Note: “autoresponder-path=/usr/local/bin” this line in the configure arguments needs to be defined correctly. Find out where autorsponder is residing and change the path accordingly the path may differ according to what version of autorespond was installed earlier.

You can find the location of autorespond if you type the following.

As root

which autorespond

You will get a single line output like below displaying the path for autorespond

Output

/usr/local/bin/autorespond

So the path to autorespond is /usr/local/bin

The path is NOT /usr/local/bin/autorespond you see the difference ?

Your path may differ depending on what version of autorespond you have installed.

As root

cd /usr/ports/mail/qmailadmin

Now the configuration arguments below assumes as an example that

cgi-bin            is located here /usr/local/www/cgi-bin
www               is located here /usr/local/www
imagedir        is located here /usr/local/www/qmailimages
autorespond is located here /usr/local/bin/
users             50 listed on each page before hitting next
forwards        50 listed on each page before hitting next

The arguments below must be typed in ONE SINGLE LINE I can’t emphasize this enough.

Change the settings in “bold” below to match your setup. Remember this is ONE SINGLE LINE

As root

make CONFIGURE_ARGS="--enable-modify-spam=Y --enable-spam-command='|preline -f /usr/local/bin/maildrop mailfilter' --enable-cgibindir=/usr/local/www/cgi-bin --enable-htmldir=/usr/local/www --enable-imagedir=/usr/local/www/qmailimages --enable-maxusersperpage=50 --enable-maxaliasesperpage=50 --enable-help --enable-autoresponder-path=/usr/local/bin --enable-modify-quota"

Once completed we will install Qmailadmin.

As root

make install clean

Now whenever adding a user you have the option to enable spam checking. Now this does not delete mail marked as spam it only moves it automatically to a folder called “Spam”. You can turn on this option so that this setting is used as a default value by editing this file.

As root

vi /usr/local/share/qmailadmin/html/add_user.html

As root find this line

<input type="checkbox" name="spamcheck">

And add checked at the end

The line should now look like this

<input type="checkbox" name="spamcheck" checked>

Now weather you use the above option or not. Qmailadmin has a bug well it’s not really a bug but rather an annoyance. “Spam Check Off” has no effect on the user creation screen. You will need to create the user and if you want “Spam Check Off” click on that user after creation and then uncheck the “Spam Check Flag”. This has no impact on Qmailadmin’s functionality and my best guess is that most people will choose to have “Spam Check On” as default and therefor it has gone unnoticed.

Now you should be able to access qmailadmin by typing the following url in a browser of your choice either

http://www.yourdomain.xxx/cgi-bin/qmailadmin or IP-Number/cgi-bin/qmailadmin

Guide On How To Install Qmail On FreeBSD  Guide On How To Install vQadmin On FreeBSD

Official Qmailadmin Site