MailScanner Installation Guide - ZMailer

How mailscanner works with ZMailer

As ZMailer has a clear distinction between the accepting of a message (either via SMTP with smtpserver or locally via the sendmail command), the routing and the delivery of the message, MailScanner sits between the accepting and the routing of the message.

That is, in the graph that shows ZMailer's processes interaction, you would see a new MailScanner process processing messages from the input spool and leaving them in the router spool.

Unlike Sendmail, Exim and Postfix implementations of ZMailer, you don't need two instances of ZMailer to run MailScanner, but you slightly modify one part of a standard ZMailer setup. In fact, the equivalent of the "incoming sendmail" part of a standard MailScanner installation is done by a slightly differently configured smtpserver; and the equivalent of the "outgoing sendmail" part, is done by a standard router and scheduler.

There are two ways of installing ZMailer and MailScanner, that is, you grab the sources and compile ZMailer, and get the MailScanner tarball and configure everything manually, or, in a GNU/Linux environment with RPM support you install everything via RPM.

Here you'll find instructions to handle both kinds of setup: using RPM or Manual

RPM Installation

and uncomment the following one:


so it says:


and the lines:

Incoming Queue Dir = /var/spool/
Outgoing Queue Dir = /var/spool/mqueue

so they look like:

Incoming Queue Dir = /var/spool/postoffice-incoming/router
Outgoing Queue Dir = /var/spool/postoffice/router

Manual Installation

How to Set Up ZMailer for MailScanner Use

  1. Install ZMailer (version 2.99.55 or newer) and get it all working.
  2. Stop ZMailer using a command
    zmailer stop
  3. Create a new postoffice for smtpserver to leave messages in.
    (suppose your current postoffice is at /var/spool/postoffice)
    mkdir /var/spool/postoffice-incoming
    chmod 2755 /var/spool/postoffice-incoming
    mkdir /var/spool/postoffice-incoming/public
    chmod 3777 /var/spool/postoffice-incoming/public
    mkdir /var/spool/postoffice-incoming/router
    chmod 3777 /var/spool/postoffice-incoming/router
    mkdir /var/spool/postoffice-incoming/freezer
    chmod 3777 /var/spool/postoffice-incoming/freezer
    chown -R root:mail /var/spool/postoffice-incoming
    rm -f /var/spool/postoffice/.pid.smtpserver
    ln -sf /var/spool/postoffice-incoming/.pid.smtpserver /var/spool/postoffice
  4. You must edit the zmailer.conf file and add a line like this:
    (e.g under the line that starts with POSTOFFICE=), then look for the SMTPOPTIONS variable in there (that specifies the line command options to call smtpserver) and add
    among those options.
    This will make smtpserver to leave messages in /var/spool/postoffice-incoming/router instead of /var/spool/postoffice/router.

How to Set up MailScanner for Use with ZMailer

In your MailScanner.conf file (probably in /etc/MailScanner or /opt/MailScanner/etc), there are 3 settings you need to change. They are all really near the top of the file. The settings are

    Incoming Queue Dir = /var/spool/postoffice-incoming/router
    Outgoing Queue Dir = /var/spool/postoffice/router
    MTA = zmailer

However, you should check where is zmailer's sendmail emulation program and configure the following variables accordingly:

    Sendmail = /usr/local/zmailer/bin/sendmail

    Sendmail2 = /usr/local/zmailer/bin/sendmail

Starting It All Running

  1. Start ZMailer
  2. Start MailScanner

Startup scripts

Unlike the standard RPM Insallation, I like to have independent startup scripts for starting ZMailer and MailScanner. The standard ZMailer RPM package by Xosé Vázquez has a startup script for ZMailer. I left a copy here for you to grab.

I also modified a version of MailScanner's startup script so it only starts MailScanner independently from the MTA. It is here and it should run with any MTA, provided you convince the MTA to start its two instances apropiately, as we described for ZMailer here.

Julian Field