Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 202 lines (125 sloc) 6.092 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
# this file is best read with `perldoc README`

=head1 NAME

Qpsmtpd - qmail perl simple mail transfer protocol daemon




What is Qpsmtpd?

Qpsmtpd is an extensible smtp engine written in Perl. No, make that
easily extensible! See plugins/quit_fortune for a very useful, er,
cute example.

=head2 What's new in this release?

See the Changes file! :-)

=head1 Installation

=head2 Required Perl Modules

The following Perl modules are required:
   Mail::Header (part of the MailTools distribution)

If you use a version of Perl older than 5.8.0 you will also need

The easiest way to install modules from CPAN is with the CPAN shell.
Run it with

  perl -MCPAN -e shell

=head2 qpsmtpd installation

Make a new user and a directory where you'll install qpsmtpd. I
usually use "smtpd" for the user and /home/smtpd/qpsmtpd/ for the

Put the files there. If you install from Subversion you can just do
run the following command in the /home/smtpd/ directory.

   svn co .

Beware that the trunk might be unstable and unsuitable for anything but development, so you might want to get a specific release, for example:

   svn co .

chmod o+t ~smtpd/qpsmtpd/ (or whatever directory you installed qpsmtpd
in) to make supervise start the log process.

Edit the file config/IP and put the ip address you want to use for
qpsmtpd on the first line (or use 0 to bind to all interfaces).

If you use the supervise tools, then you are practically done now!
Just symlink /home/smtpd/qpsmtpd into your /services (or /var/services
or /var/svscan or whatever) directory. Remember to shutdown
qmail-smtpd if you are replacing it with qpsmtpd.

If you don't use supervise, then you need to run the ./run script in
some other way.

The smtpd user needs write access to ~smtpd/qpsmtpd/tmp/ but should
not need to write anywhere else. This directory can be configured
with the "spool_dir" configuration.

As per version 0.25 the distributed ./run script runs tcpserver with
the -R flag to disable identd lookups. Remove the -R flag if that's
not what you want.

=head2 Configuration

Configuration files can go into either /var/qmail/control or into the
config subdirectory of the qpsmtpd installation. Configuration should
be compatible with qmail-smtpd making qpsmtpd a drop-in replacement.

If qmail is installed in a nonstandard location you should set the
$QMAIL environment variable to that location in your "./run" file.

If there is anything missing, then please send a patch (or just
information about what's missing) to the mailinglist or to

=head1 Better Performance

As of version 0.21 qpsmtpd supports "PPerl"

"PPerl turns ordinary perl scripts into long running daemons, making
subsequent executions extremely fast. It forks several processes for
each script, allowing many processes to call the script at once."

Running under PPerl is easy - just change your "run" file to contain
the following command:

  pperl -Tw -- --prefork=$MAXCLIENTS --maxclients=$MAXCLIENTS \
    --no-cleanup ./qpsmtpd 2>&1

As an alternative to PPerl (some users find PPerl unstable) we recommend using
the forkserver. This forks for every connection, but pre-loads all the plugins
to reduce the overhead.

=head1 Plugins

The qpsmtpd core only implements the SMTP protocol. No useful
function can be done by qpsmtpd without loading plugins.

Plugins are loaded on startup where each of them register their
interest in various "hooks" provided by the qpsmtpd core engine.

At least one plugin MUST allow or deny the RCPT command to enable
receiving mail. The "check_relay" plugin is the standard plugin for
this. Other plugins provides extra functionality related to this; for
example the require_resolvable_fromhost plugin described above.

=head1 Configuration files

All the files used by qmail-smtpd should be supported; so see the man
page for qmail-smtpd. Extra files used by qpsmtpd includes:

=over 4

=item plugins

List of plugins, one per line, to be loaded in the order they
appear in the file. Plugins are in the plugins directory (or in
a subdirectory of there).

=item rhsbl_zones
Right hand side blocking lists, one per line. For example: does not accept bounces -

See for more examples.

=item dnsbl_zones

Normal ip based dns blocking lists ("RBLs"). For example:

=item require_resolvable_fromhost
If this file contains anything but a 0 on the first line, envelope
senders will be checked against DNS. If an A or a MX record can't be
found the mail command will return a soft rejection (450).

=item spool_dir

If this file contains a directory, it will be the spool directory
smtpd uses during the data transactions. If this file doesnt exist, it
will default to use $ENV{HOME}/tmp/. This directory should be set with
a mode of 700 and owned by the smtpd user.

=item everything (?) that qmail-smtpd supports.

In my test qpsmtpd installation I have a "config/me" file containing
the hostname I use for testing qpsmtpd (so it doesn't introduce itself
with the normal name of the server).

=head1 Problems

In case of problems always first check the logfile.

As default it goes into log/main/current. Qpsmtpd can log a lot of
debug information. You can get more or less by adjusting $TRACE_LEVEL
in lib/ (sorry, no easy switch for that yet). Something
between 1 and 3 should give you just a little bit. If you set it to
10 or higher you will get lots of information in the logs.

If the logfile doesn't give away the problem, then post to the
mailinglist (subscription instructions above). If possibly then put
the logfile on a webserver and include a reference to it in the mail.
Something went wrong with that request. Please try again.