Plesk, Qmail and Spamdyke

Spamdyke installation is quick and easy. It seamlessly installs between Plesk and Qmail. Below we will show you how to install this application and then how to maintain it with Plesk Event Manager.

The Install

1 download the latest Tarball from

2 Upload the Tarball to your server of choice via FTP or SCP or use wget directly from the site.

3 Unpack the spamdyke tarball somewhere convenient, like /tmp:

cd /tmp
tar -xzvf spamdyke-x.y.z.tgz

4 Change to the “spamdyke” folder, run “configure” and “make”:

cd spamdyke-x.y.z/spamdyke

You shouldn't see any errors or warnings.

If the “configure” script finds the OpenSSL libraries, spamdyke compiles with TLS support. If TLS is not desired (why?), run the “configure” script with the “disable-tls” flag.

cd spamdyke-x.y.z/spamdyke
./configure --disable-tls

You shouldn't see any errors or warnings.

5 Copy the spamdyke executable to /usr/local/bin:

cp spamdyke /usr/local/bin 

6 Find the script that runs qmail when an incoming connection is established.

If your qmail installation is part of Plesk, look for:

cp /etc/xinetd.d/smtp_psa /etc/xinetd.d/smtp_psa.orig
cp /etc/xinetd.d/smtps_psa /etc/xinetd.d/smtps_psa.orig

nano /etc/xinetd.d/smtp_psa 

Insert the spamdyke command before the ”/var/qmail/bin/qmail-smtpd” command. Something like this:

/usr/local/bin/spamdyke -f /etc/spamdyke.conf /var/qmail/bin/qmail-smtpd 2>&1

Sometimes, the spamdyke command should be placed within a variable that is substituted into the command line. If the script includes the rblsmtpd command, it can be replaced with the spamdyke command.

Run the spamdyke command with the ”-h” flag to see the available options and read the README.html file for full details. Please don't enable a feature if you don't understand what it does!

7 Restart qmail after you create the configureation file and appropriate folders shown below.

If your qmail installation is part of Plesk:

     killall -HUP xinetd 


    /etc/init.d/xinetd condrestart 

8 That's it. Watch syslog for any errors

 tail -f /usr/local/psa/var/log/maillog 

System Files and Folders

Now we must create the directories for our greylists:

mkdir -p /var/qmail/spamdyke/greylist

touch /var/qmail/spamdyke/blacklist_ip \
/var/qmail/spamdyke/blacklist_recipients \
/var/qmail/spamdyke/whitelist_ip \
/var/qmail/spamdyke/blacklist_keywords \
/var/qmail/spamdyke/blacklist_senders \
/var/qmail/spamdyke/whitelist_senders \

next we create the proper permissions for the files:

chown -R qmaild:nofiles /var/qmail/spamdyke

Now we need to create folders of all domains(which should be protected) in the greylist directory

cd /var/qmail/spamdyke/greylist/

for i in `ls -1 /var/qmail/mailnames`; do mkdir $i; done

chown -R qmaild:nofiles /var/qmail/spamdyke

The Configuration File

This is one that we have used. it is very aggrssive but works! Please do not use anything you do not understand. You can find more information about all FLAGS at

example Configuration file: spamdyke.conf



Plesk Event Manager

Now we need to tell plesk to create a directory in the greylists folder everytime we create a new account/domain. After hours of research, searching, and trial and error we, Blue Oryx, Finally have the answer and are sharing it with the world!!!

cd /usr/local/psa/bin


chown root:root
chmod 755


now copy and paste the below. change the greylist_path if necessary. however, if you followed our instructions, nothing should change.

# -------------------------------------------------------------------------
# - This script creates a folder for spamdyke
# greylists
# Usage   : Use with Plesk Event Manager - Domain Created/root
#                       qmail server and spamdyke required
# Notes   : Servers must be running Plesk 8.3 or higher (only tested so far)
#                       Plesk Command: /usr/local/psa/bin/ 
# Copyright (C) 2008 Blue Oryx Internet Solutions, LLC
# Email/Contact   :
# Author          : Vincenzo S Barranca
# Date            : Jan-2008
# Last updated    : Jan-2008
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Blue Oryx has provided this script bug free and working as is.
# If file is changed by any party not certified by Blue Oryx, all
# warranties shall be voided and support will be billed. This File is
# provided without any warranties. Use this script at your own risk
# Blue Oryx cannot be held responsible for the use of this file. It works for us
# But maybe not for you.
# -------------------------------------------------------------------------
#      EDIT Here If Needed
# -------------------------------------------------------------------------

# greylist folder


#go to greylist folder
cd $greylist_path

# add new folder
mkdir $1

# create proper permissions
chown qmaild:nofiles $greylist_path$1


now you need to go to Plesk and login. Go to Server >Event Manager > Add New Event Handler

  1. For Event choose “Domain Created”
  2. For Priority we chose “Normal(50)
  3. For User, you must choose root
  4. and now for the grand finally!!! copy and paste this code into the Command textarea if you followed the steps above

and pres OK

Now you can go to your SSH terminal and go to

cd /var/qmail/spamdyke/greylist


Now go to Plesk and create a new Domain (this can be a fake one you can throw away when done).

After the domain has been created go back to the SSH Terminal and run the list command again. You should see a matching folder to the domain you just created!

All Done!

Watch logs in Plesk

Logs found here: /usr/local/psa/var/log/maillog


  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

HOWTO install Gnome and VNC on your Linux VPS

Install Gnome Desktop, VNC Server and Xterm: yum groupinstall gnome-desktop yum install...

SSH without passwords

If you need quick access from your linux desktop to the VPS there is an easy solution that won't...

How to move a website without downtime

You have a website you need to move to a new web server on a new IP address. You intend to keep...

Automatic MySQL backup using automysqlbackup

Sooner more than later, you will regret not having proper backups of your MySQL databases....

Download all files and folders from remote FTP server

This is a useful command that will download all files and folders from a remote FTP server:wget...