Closed TopicStart new topicStart Poll

> Info: XMail & Linux Howto, An installation guide ...
Posted: Dec 11 2002, 05:03 PM
Quote Post

No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02

For those, who have problems with the .rpm package or if you need to check an unsuccessful .rpm-installation:


LFS VERSION: 3.3, 4.0 and CVS
AUTHOR:  Richard Downing <>

How to set up xmail-1.11 instead of sendmail, postfix, qmail at al.

This hint explains how to build and set up xmail on your LFS system. Xmail, by
Davide Libenzi, is a single server which replaces, say,
sendmail+qpopper+fetchmail, or as I used on an LFS system long ago,

And since I know that this hint is linked to from the Xmail website, I should
add for Xmail readers that LFS = Linux From Scratch - the best way to learn
Linux and Unix, by building one from sources: Visit

Why Xmail? Basically: why install three or four packages when one will do the

The big problem with xmail-1.11 is that Davide hasn't got around to writing
either a configure script or an installation script.  This presents just a few
interesting opportunities for error, especially if you are still a bit
unix-challenged.  However once the package is installed it appears to work well
and do what it is advertised to do.

There is an active, knowledgable, but a bit busy, mailing list.

I have used these instructions on a number of LFS builds, including my latest,
LFS CVS20021105 with glibc-2.3.1/gcc-3.2.1, with complete success.

Obtain and Unpack the package.

Download the package from:

It's a .tar.gz, so unpack in the usual way, and cd xmail-1.11.  (Note: I've used
this process to build Xmail's since version 1.8, so I expect they will still
work for the next few releases - let me know if they let you down or need

Start by checking out the documentation in the docs directory: Readme.html or
Readme.txt is the only manual!

Build the executables.
Choose your Makefile depending on the architecture of your LFS machine:

make -f Makefile.lnx  - for an i86 box
make -f Makefile.slx  - for a SPARC
make -f Makefile.plx  - for a PPC

(Note I only have experience with i86)

You can strip the executables now if space is an issue.

This will build Xmail and it's toolset, this includes a SysV init script which
works on a LFS system, but more on that later.

Install Xmail.

This is where the fun comes.  Su to root if you are not already.

cp -a MailRoot /var
chmod 700 /var/MailRoot

Most of XMail's files are held in /var/MailRoot, which is only accessable by

cp XMail XMCrypt MkUsers sendmail /var/MailRoot/bin

However the CtrlClnt binary needs to be accessible to whoever is going to
administer the xmail system:

cp CtrlClnt /usr/bin

Copy the Manual to appropriate places:

cp -p Readme.txt /usr/share/xmail/Manual.txt
cp    Readme.html /usr/share/xmail/Manual.html

If you plan to use Davide's init script copy it now:

cp xmail /etc/rc.d/init.d

Or create a more LFS-like script, such as:

cat > /etc/rc.d/init.d/xmail << "EOF"

# Begin $rc_base/init.d/XMail

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  -
# XMail init script by Richard A Downing -
# using LFS template and XMail-1.11 skeleton.

source /etc/sysconfig/rc
source $rc_functions

export MAIL_ROOT=/var/MailRoot
export MAIL_CMD_LINE="-Qn 2 -Pl -Sl -Fl -Cl -Ll"

case "$1" in
 echo "Starting XMail ..."
 loadproc $MAIL_ROOT/bin/XMail

 echo "Stopping XMail ..."
 killproc XMail

 echo "Reloading XMail ..."
 reloadproc XMail

 $0 stop
 sleep 1
 $0 start

 statusproc XMail

 echo "Usage: $0 {start|stop|reload|restart|status}"
 exit 1

# End $rc_base/init.d/XMail

Replace or create a sendmail script

If your MUA (Kmail, for instance) interfaces (when sending mail) with the MTA
using SMTP you can skip this step entirely, but some MUA's need a sendmail
script which you can create like this.

The sendmail executable needs the SETGUID bit set to run as root and this might
be a security hole.

If you already have a sendmail script or program, move it aside (your's might be
in /usr/bin or elsewhere):

mv /usr/sbin/sendmail /usr/sbin/sendmail.orig

Copy Xmail's sendmail executable to an appropriate place, and set it's SETUID
bit so that it runs as root.

cp sendmail /usr/sbin/sendmail.xmail
chmod +s /usr/sbin/sendmail.xmail

And create a sendmail script to set the environment and call the executable:

cat > /usr/sbin/sendmail << "EOF"
# This script sets the environment for XMail's sendmail and then calls it.
# The script exists so that software that expects sendmail can use XMail.

if [ -z $MAIL_ROOT ]; then
       export MAIL_ROOT=/var/MailRoot
/usr/sbin/sendmail.xmail $*
# End /usr/sbin/sendmail

chmod +x /usr/sbin/sendmail

Configure Xmail's

It's important to note that all of xmail's configuration files use the 'tab'
character as a separator character - don't use spaces or extra tabs, and every
line, EVEN THE LAST ONE in a file must have a terminating <return>.   For this
reason, apart from the following, I don't edit the tab files directly, prefering
the control interface, see later.

Use your favourite text editor to edit /var/MailRoot/ for your domain
name, and set the names of the user's who will get error and postmaster
The files as delivered contain a reasonable starting point with a domain called
'xmailserver.test' which you can use to try things out if you want.

The server configuration variables are well described in part 12 of
the Manual (which you saved in /usr/share/xmail/Manual.txt !) - so check what
your situation needs.  My is:

"RootDomain" ""
"POP3Domain" ""
"PostMaster" ""
"ErrorsAdmin" ""
"DefaultSMTPGateways" ""
"RemoveSpoolErrors" "0"
"MaxMTAOps" "16"
"ReceivedHdrType" "0"
"FetchHdrTags" "+X-Deliver-To,+Received,To,Cc"
"Pop3SyncErrorAccount" ""
"DefaultSmtpPerms" "MRVZ"

(note: I have not registered, as it's never seen outside of my

Setup the file to contain the name of your domain:

Now set up a 'control' account, I called mine 'root'.  Choose a nice complicated
password and find its encrypted form with XMCrypt, I'll use 'ciao' as an
/var/MailRoot/bin/XMCrypt ciao

Now edit /var/MailRoot/ to read something like this, where the
second element is the string that XMCrypt returned:
"root" "060c040a"

Note the double-quotes are really there in the file and the separator IS a
single 'tab' and the line IS terminated with a <return>.  Wherever a 'tab' file
format calls for a password, it's an XMCrypt password that's needed - this
caused me a lot of problems!

You will need at least one user set up in /var/MailRoot/, and while

you are editing it delete the sample account for 'xmailuser', remember to use
XMCrypt to find your encrypted password.

and that is sufficient to get XMail running.

Start XMail for the first time.

Start XMail in debug mode with the following commands:

export MAIL_ROOT=/var/MailRoot
/var/MailRoot/bin/XMail -Md -Pl -Sl -Fl -Cl -Ll ...

where the ... are any other command line switches you might want or need - see
part 19 of the Manual.  (By the way those switches end with a lower case L - not
obvious in some fonts!)

You will see the various XMail threads start up, and if all looks stable you
have a working XMail.  If you can start another terminal session, a second xterm
or login on another tty, then you can command XMail (see next session) and watch
the debugging output.  When you are happy, hit Ctrl-C and abort the run,
watching XMail shut down it's threads gracefully.

Setup the SysV init script.

Link the SysV init script as you see fit into the rc.d system, I set:

cd /etc/rc.d
ln -s init.d/xmail rc0.d/K27xmail
ln -s init.d/xmail rc1.d/K27xmail
ln -s init.d/xmail rc2.d/K27xmail
ln -s init.d/xmail rc6.d/K27xmail
ln -s init.d/xmail rc3.d/S43xmail
ln -s init.d/xmail rc4.d/S43xmail
ln -s init.d/xmail rc5.d/S43xmail

although I actually do it with KDE3's SysV-Init editor.

The aim is to close xmail before the network goes down, but after any activity
which might cause mail activity, and to start xmail after the network is up, but
before starting anything that might generate mail (for example: fcron).

Now you can run the xmail daemon properly by issuing:

/etc/rc.d/init.d/xmail start

which will fork the daemon and display its process id (pid).  Now you can set up
your other accounts and the links to mail servers at your ISP, and becuase you
are asking XMail to do it for you, you are assured that the setup will be

Setting up another user account.
Type the following, you don't need to be 'root':

/usr/bin/CtrlClnt -s -u root -p ciao \
useradd newuser newpassword U

Of course, you need to substitute your domain name, Control Account and

In these CtrlClnt (Control Client) commands you should NOT use MKCrypt-ed

Once the user account(s) are set up, you can try sending mail between them
locally.  Set up your MUA, say Mutt or Kmail, to send via smtp localhost:110,
and receive by POP3 from '' or whatever your domain is
called, with the appropriate username and password as just setup.

Setting up a POP3 drop from your ISP.
Assuming your ISP presents a simple unencrypted (old-fashioned) POP3 service,
you need to know your login name (you-at-isp) and password
(your-isp-pop-password)and the address of the POP3 server.

/usr/bin/CtrlClnt -s -u root -p ciao \
poplnkadd richard \ you-at-isp your-isp-pop-password CLR

This will set up an automatic synchonisation between XMail and your pop3 account

at, syncronising every 2 minutes (120 seconds).
To change the synchronisation rate to, say, every 5 minutes, you need to edit
command line switch -Yi 300 (300 seconds) in /etc/rc.d/init.d/xmail.

If your ISP supports APOP authorisation substitute APOP for CLR above.

That's all I did, and it works for me.  Good luck.


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Documentation and Knowledge Base | Next Newest »

Closed TopicStart new topicStart Poll