Installing and Initial Setup of the DMail Package

(To: Table of Contents)

The parts of the package are:

DSMTP - SMTP mail server
DPOP - POP3 mail server
DList - email list server
DWatch - monitor for the above 3 servers

Pre-Installation

(To: install instructions)
Before installing DMail you need to think about:

  • Your operating system

    Check the OS Installation Notes for details about your server operating system. You should do this before reading the rest of this manual in order to discover any OS-specific behaviour that will effect the installation and use of DMail.

  • Servers already on your system

    If you are running sendmail, DMSetup will stop sendmail for you.

    You need to stop any running POP server, as well as any SMTP server other than sendmail.

    How to check for other servers:

    Enter the following at a command prompt in order to check if you have a POP server running,
        telnet localhost 110
    If something responded then you need to stop it (details on how to do this are below).

    Enter the following at a command prompt to check if you have an SMTP server running,
        telnet localhost 25
    If something responded, check if it mentions 'sendmail'. If something responded other than sendmail then you need to stop it (details on how to do this are below).

    (Not sure how to close the telnet session? : if something responded use the command,
        quit
    or use CTRL-] then quit on UNIX based telnet)

    How to stop other servers:

    On UNIX type systems, if you are running sendmail this is normally done by editing inetd.conf and then sending the inet process a HUP signal to get it to reload. The DMSetup wizard will perform these steps for you unless you tell it not to.

    If you are running a mail server other than sendmail, you will need to manually shutdown that server before running DMSetup. Most mailservers have an easy, safe shutdown process.If you are unsure about how to shut down your existing mailserver, you can try using the killcommand, but this may cause instability or data loss.

    If you need to use kill, this is an example of how to do so. Say your system is running a mailserver called oldmail.

    ps -ax | grep 'oldmail'
    If oldmail is running, ps will return a line like this:
    xxx ?? Ds 24:27.58 /usr/bin/oldmail
    where xxx is the process id for oldmail. Then, you can kill the process with kill. Simply replace the xxx with whatever process id was returned by the ps command.
    kill -9 xxx

  • Running on non-standard ports:

    Alternatively, DPOP and DSMTP can be installed and not started (DMSetup asks you if you want the servers started). Later you can start them manually after first changing the ports that they operate on so that they do not interfere with the operation of another popper or SMTP server. For details, see the config settings smtp_port and pop_port

Installation

The DMSetup setup application wizard will guide you through the initial setup and installation of the DMail package which includes DSMTP, DPOP and DList. It can also be used to simplify upgrading to a newer version of DMail or for removing the DMail applications. It will automatically determine which package you have downloaded and whether you are installing just DPOP or the complete package including DMail, DPOP and DList.

A note on virtual domains:
If you are planning to add many domains, we suggest that you pick one of these domains to be your main domain. Use DMSetup to add only this domain, get it working so that you can send and receive email and only then set about adding the other domains. We refer to the other domains that you add as 'virtual domains' in this manual, although there is very little difference between them and your main domain. Virtual domains are created in dmail.conf with 'vdomain' lines, whereas your first or 'main' domain is created with a host_domain setting.

DMSetup will create the required configuration files for all of the server products (almost everything is in dmail.conf). These configuration files will be tailored to your system and selected preferences. Nearly all of the settings can be changed later, but it is generally best to use the DMSetup program at least once in order to get your main configuration options correct. To install the DMail products, you proceed as follows:

On UNIX

  1. Log in as root
  2. Download the DMail distribution set to a temporary directory
    ( e.g. root/chris/temp/dm119_linux.tar.Z )
  3. Unpack the files with the commands like:
    uncompress dm119_linux.tar.Z
    tar -xvf dm119_linux.tar
  4. Change directory cd dmtemp
  5. Use command ./dmsetup to run the installation wizard
  6. Answer the questions the wizard asks.(Notes on DMSetup Questions)
  7. Test the DSMTP/DPOP/DList mail servers you have installed.(Instructions in What Next? section)
  8. If DMail does not start automatically on reboot, change the startup scripts so that it does.
  9. Go to, What Next? section.

On Windows NT

  1. Download the DMail distribution set into a temporary directory
  2. At completion of download the DMSetup wizard will be started automatically
  3. Answer the questions the DMSetup wizard asks.(Notes on DMSetup Questions)
  4. Test the DSMTP/DPOP/DList mail servers you have installed.(instructions in What Next? section)
  5. Go to, What Next? section.

Note: If NT_User passwords are used then DPOP must be run with enough privilege to allow password checking. i.e. from an account with the "act as part of operating system" right set.

The DMSetup Wizard

This is an initial setup program which runs from the self-extracting zip file on Windows NT and the ./dmsetup command on UNIX.

It asks a series of setup questions, most of which have default responses (given in square brackets), which you can select by simply pressing a carriage return. All of the responses that you give to DMSetup can be changed later on, after installation, so it is often a good idea just to accept the defaults and then change the ones you need to be different once you are more familiar with the package.

CLick here for Notes on DMSetup Questions

DMSetup creates an initial configuration file, dmail.conf, based on the responses that you give to it's questions. It also copies the DMail files to the various locations, including the configuration file, dmail.conf, to the system directory.

On both Windows and UNIX it will try, by default, to create a directory called 'dmail' and to point all of the server's path settings to this directory, e.g. it will point dsmtp_path to the DMail directory. The DMail directory is then used to store the manual, the utility executables and almost all parts of DMail, except for the config file dmail.conf.

On Windows NT it will also, by default, create the following directory structure,

DMail 	-> 	DList
	->	dwatch
	->	in
	->	log
	->	work

and set the various path settings, e.g. work_path, log_path, dwatch_path, etc. to match.

If the complete DMail package is installed on a UNIX machine, the sendmail application is saved and replaced by a sendmail stub. The DMSetup wizard can do this for you at installation time. DMSetup will also restore the original sendmail application, if requested, when removing other parts of DMail

Once DMSetup has finished the installation it starts the DWatch program, which in turn starts each of the three email servers, DPOP, DSMTP and DList. If you are running DMail on Windows NT then it will also automatically start the DMAdmin GUI server management utility.



Startup Scripts

In most cases, DMSetup will configure your machine to start DMail automatically upon reboot. If DMail does not start automatically, you will need to modify your system startup scripts.

NOTE: We recommend that, before following the instructions in this section, you check the OS Installation Notes for your operating system. Many files, directories and procedures mentioned in this section are OS-dependant.

Windows Platforms:

The DMSetup program adds the dwatch service to the list of services on Windows NT machines. So the DMail servers should start at startup. You can edit the dwatch startup options in the Services dialog of Control Panel.

On non-NT windows platforms the DMSetup installation utility will add the registry key "DWatch" to HKEY_LOCAL_MACHINE - SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunServices

You can also simply add a shortcut for the dwatch.exe executable to your startup menu. This option can be good for testing as you can easily kill any subprocesses from the task manager.

UNIX-based Platforms:

The DMSetup installation utility should have added lines to your startup script to start the dwatch process at startup, unless you instructed it not to start the servers.

It will generally create a dmail.init file (i.e. /etc/rc.d/init.d/dmail.init) and appropriate links to it for the different run levels. If it hasn't been able to do this then it tries to add startup lines to the file, /etc/rc.d/rc.local

If DMSetup has put them in the wrong place or cannot find the startup script, then you should add the following two lines to your system's equivalent of the file /etc/rc.d/rc.local

rm -f /usr/local/dmail/dwatch/*.pid
/usr/local/dmail/dwatch/dw_start.sh

The dw_start.sh script starts DWatch, which in turn starts all the DMail components. If you wish to start individual components, such as DPOP or DSMTP, use these scripts:

Component Typical Script Pathname
DPOP /usr/local/dmail/dpop_start.sh
DSMTP /usr/local/dmail/dm_start.sh
DList /usr/local/dmail/dlist/dlist_start.sh

The notes below have general information on where to put these scripts and situations where they need editing, along with an example runlevel startup script.

NOTES:

  1. The startup scripts set a limit on core file dumps, so that if the program dies, a core file is created which is very helpful for finding the bug. For most systems:
    ulimit -c 20000
    sets this. Unfortunately, the DMail scripts used not to have the correct first line,
    !#/bin/sh
    in them to run the sh shell. So you should check that all of the files,
    /usr/local/dmail/dwatch/dw_start.sh
    /usr/local/dmail/*.sh
    /usr/local/dmail/dlist/dlist.sh
    start with that line.

    The 'not as good alternative' is that you check that this command is valid for your shell, you may need to change it to, for example, (for csh shell),

    limit coredumpsize 20000
  2. If your system does not have either of these files:
    /etc/rc.d/init.d/dmail.init
    /etc/rc.d/rc.local
    then be assured that dmsetup will not have put the startup script lines anywhere else. So you need to do it manually.
  3. If you are having trouble locating where to put the startup lines, search for where sendmail's startup scripts are.

    For example, the file

    /etc/rc.d/init.d/sendmail
    is often sendmail's startup script, which looks like this:
    *****File Content Within Stars *****
    #!/bin/sh
    #
    # sendmail This shell script takes care of starting and stopping
    # sendmail.
    #
    # chkconfig: 2345 80 30
    # description: Sendmail is a Mail Transport Agent, which is the program \
    # that moves mail from one machine to another.
    # processname: sendmail
    # config: /etc/sendmail.cf
    # pidfile: /var/run/sendmail.pid

    # Source function library.
    . /etc/rc.d/init.d/functions

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0
    [ -f /usr/sbin/sendmail ] || exit 0

    # See how we were called.
    case "$1" in
      start)
        # Start daemons.
        echo -n "Starting sendmail: "
        daemon /usr/sbin/sendmail -bd -q1h
        echo
        touch /var/lock/subsys/sendmail
        ;;
      stop)
        # Stop daemons.
        echo -n "Shutting down sendmail: "
        killproc sendmail
        echo
        rm -f /var/lock/subsys/sendmail
        ;;
      restart)
        $0 stop
        $0 start
        ;;
      status)
        status sendmail
        ;;
      *)
        echo "Usage: sendmail {start|stop|restart|status}"
        exit 1
      esac
     
    exit 0

    *********************************

    If you locate that file then you can rename it to something else and replace it with this content so that DSMTP is started instead of sendmail. Note that you must replace the paths in this file with the actual paths on your machine if you have not used the default DMail path values:


    Example runlevel startup script:
    *****File Content Within Stars *****
    #!/bin/sh
    #
    # Startup / shutdown script for DMail servers
    #
    #
    # Start or stop ?
    case "$1" in
      start)
        # start servers
        echo -n "Starting dmail servers: "
        echo
        rm -f /usr/local/dmail/dwatch/*.pid
        /usr/local/dmail/dwatch/dwatch
        ;;
      stop)
        # stop servers
        echo -n "Stoping dmail servers: "
        echo
        tellpop shutdown 10
        tellsmtp shutdown
        cp /usr/local/dmail/dwatch/dlist.pid /usr/local/dmail/dwatch/dlist.exit
        ;;
      *)
      echo -n "Usage: dmail {start|stop}"
        echo
        exit 1
      esac
     
    exit 0

    *********************************
  4. Check,
    OS Installation Notes
    If your operating system has paths which we haven't mentioned then please let us know and we will gladly include them in our documentation.

 



OS Installation Notes

All Operating Systems:

  • Note: you cannot use spaces in path names in the configuration file, e.g. you can NOT have a dsmtp_path setting like:
    dsmtp_path c:\program files\dmail

BSDI:

  • You need to check that the startup script files use:
    limit coredumpsize 20000
    or the equivalent for your platform.

FreeBSD:

  • In most current versions (3.1 or later at time of writing), startup scripts are normally placed in the /usr/local/etc.rd directory. These shell scripts should be set executable, and end with a .sh In FreeBSD 3.0 and earlier releases, you should edit the /etc/rc.local file. For more information on configuring FreeBSD startup scripts, see http://www.freebsd.org/FAQ/admin.html

Linux libc6:

  • Versions 2.4j and upwards have been built for Linux platforms with the Version 6 C libraries, found on Red Hat Linux 5.2 as well as with the older libraries.
  • Such versions are referred to in the documentation and on the download page, as the libC6 versions, e.g.
    dm24j_linux_libc6.tar.Z
  • LibC6 versions are required if you intend to use shadow passwords and the Yellow Pages system for shared password files. They also fix the time zone problem - see Time Zone problems on UNIX

Linux Debian:

  • Startup Scripts can be created with the following,
    make ...
    dmail.sh in /etc/init.d/

    add the two lines ...
    rm -f /usr/local/dmail/dwatch/*.pid
    /usr/local/dmail/dwatch/dw_start.sh
    (or use the example startup script)
    save it ..
    type ..
    update-rc.d DMail defaults
    it creates all the startup and shutdown calls in rc.blah.

Mac OSX Server:

  • Ensure that you run the installation from a 'Terminal' command line prompt which is NOT using a GUI Admin tool!
  • Note: you cannot use spaces in path names in the configuration file, e.g. you can NOT have a dsmtp_path setting of:
    dsmtp_path /Local/Library/Mail Server/
  • The startup scripts are in /etc/startup and you need to edit the mail script, e.g. 1800_mail to look like this (or use the fuller, example startup script),
    *****File Content Within Stars *****
    #!/bin/sh

    . /etc/rc.common

    ##
    # Start mail server
    ##

    rm -f /usr/local/dmail/dwatch/*.pid
    /usr/local/dmail/dwatch/dw_start.sh
    ************************************

Red Hat Linux 6.2 or above:

  • Use the 'libc6' version of the download. You are probably running the version 6 C libraries so you should be sure to use the downloads marked 'linux_libc6'
  • Location of Drop Files: On startup on some systems the default system POP server will move all drop files from /var/spool/mail to $HOME and use a filename of 'mbox', e.g. /var/spool/mail/support to ~support/mbox.

    This can make it seem as if all mail has disappeared when you start running DMail.

    We recommend that you move these drop files to /var/spool/mail.

    However, you can use the ~ symbol in the drop_path setting to specify that DSMTP uses the user's home directory as the drop path, e.g.

    drop_path ~/mbox
    will result in mail for user 'support' going to ~support/mbox.

Windows 95 and 98:

 



After Installation - What Next?

Here is a list of things to look at or consider after installation ...
(on this page)

  1. Adding Users
  2. Your DNS MX Entries
  3. Add Relay Restrictions
  4. How to send a test email

(on other pages)

For those wanting to set up a 'Hotmail' type system see,
Step by Step Install

  1. Adding Users

    Once you have installed DMail, all users on your system are valid DMail users (given that they meet any access restrictions which you set in dmail.conf). Therefore, you can add DMail users in the fashion that you would normally add users to your system. On windows NT, you go to START -> Programs -> Administrative tools -> User Manager, then select "New user" from the user menu. On UNIX you can use the newuser <username> command.

    Notes:

    • if you have set authent_domain true in dmail.conf configuration file, you should add usernames to the user database as,
      user@domain
      rather than as just 'user', where the domain to use is the first host_domain line in dmail.conf.
    • If you want to use the 'Users' button in DMAdmin, you will need to be using External Authentication which you should set manually in dmail.conf, see External Authentication.
  2. Your DNS MX Entries

    You should set up DNS MX records that point at your new email server for every domain that you intend to administer.

    Then make sure that you add either a host_domain OR a (virtual) vdomain line in dmail.conf for each of these domains.

    E.g. for two real domains, domain1 and domain2, and two virtual domains, domain3 and domain4, your dmail.conf would have these lines:
    host_domain domain1
    host_domain domain2
    vdomain vdom3 x.x.x.x domain3 /mail/dom3
    vdomain vdom4 x.x.x.x domain4 /mail/dom4

    Basically, host_domain settings tell DSMTP which other domain names it should consider as local domains, i.e. they are synonyms for your main domain. E.g. bob@domain1 also has the address bob@domain2.

    Whereas the vdomain lines specifiy local virtual domains which are domains other than your main one which you wish to host on the same machine, e.g. bob@domain1 and bob@domain3 are different users.

    Please see the section,
    Domain Name Resolution (DNS),
    for further information on what you need to set up and how DSMTP uses the DNS server.

  3. Add Some Relaying Restrictions

    The default behaviour for DSMTP is to run without any relaying restrictions. You should add some restrictions, before your email server becomes a spam gateway for all the bored people of this world.

    We suggest that you start with
    forward_from_ip 127.0.0.1
    and
    forward_from_ip x.x.x.*
    where x.x.x is the first three setions of the IP address of your machine.

    Note: In version 2.7q and above, DMSetup will automatically add these two lines for you.

    This will restrict people from giving your SMTP server mail to be delivered to any other server, i.e. non-local mail, unless they are connecting from your IP address.

    Note: As soon as you add one relaying restriction rule, DSMTP prohibits all relaying unless it is expressly allowed by a relaying rule. So the default setup is that only mail coming from your local IP Address can be relayed.

    See the Spam Rules section for information on this.

  4. How to send a test email

    To test your mail system you should try sending an email to a local user.

    In order to do this, you should use a normal email client, e.g. Pegasus Mail, Eudora, Netscape Mail etc., and point it at the new DMail server. Because you probably don't yet have a DNS entry for your domain that points to the DMail server, you should tell your email client to use the IP Address of the DMail server as the 'sending SMTP server or outgoing mail server'.

    You should then send an email to the address,
    username@domain
    where

    1. 'domain' is the domain given by the first host_domain setting in the DMail configuration file, dmail.conf (click here to find out where to locate your dmail.conf).
    2. and 'username' is a username that you have added to the user database.

    You should also try logging in to DPOP in order to collect the mail message for that user.

    Again, point your email client at the IP Address of the DMail server, and provide a username that matches the username part of what you added to the user database, e.g.
    bob
    with corresponding password.

    NOTE: if you have set authent_domain true then you will have added, user@domain to the user database, but you login to DPOP with 'user', not 'user@domain'.

    If any of these tests fail, please do the following,

    1. set,
         log_level debug
    in dmail.conf and save the file.
    2. reload both DSMTP and DPOP, by issuing the commands,
         tellsmtp reload
         tellpop reload
    at a command line.
    3. test sending in a message and trying to collect it.
    4. send us the resulting log files,
         dsmtp.log
         dpop.log
    which you will find in the log_path directory as set in dmail.conf
    5. send DMail Support your dmail.conf file, typically,
         /etc/dmail.conf or \winnt\system32\dmail.conf

 



Removing the DMail Package: DPOP, DSMTP, DList

In order to revert to the previous popper, DPOP needs to be shut down and inetd.conf again edited and another SIGHUP sent to inet. These steps can be performed for you by the DMSetup wizard.

One other major issue is that messages read but not deleted during the time DPOP is running will no longer be stored in standard drop files, but instead in its own "bin" files. Before reverting to a previous popper the DPOP bin files need to be converted back into standard drop files. This is done by using the Tellpop drop_all command.

The recommended safe-removal procedure for DSMTP/DPOP/DList is:

  1. tellpop offline
  2. tellsmtp tryall
  3. tellpop status
        ( Repeat until current users = 1 )
  4. tellsmtp status
        (Repeat until no message domains are listed, i.e. all outgoing messages have been sent)
  5. tellpop drop_all
  6. dmsetup
    Choose option 3 to remove DPOP / DSMTP / DList
  7. Restart original popper and check operation
  8. Remove unwanted files from directories identified by 'dmsetup' two steps above.

On UNIX based systems, you may have allowed DMSetup to save the sendmail application and replace it with a NetWin sendmail stub, or you may even have done it manually. If so, DMSetup will also restore the original sendmail application, if requested, when removing other parts of DMail



Sendmail Stub

The DMSetup installation wizard tries to replace the sendmail process with our 'stub'.

Because Sendmail has a command line emailing component not present in DSMTP, we provide a command line email client, which you can use to do any command line emailing. Users who telnet directly to the mail server machine and CGIs commonly use command line emailing.

What should I do if DMSetup fails to install the sendmail stub?

DMSetup tries to replace,
/usr/sbin/sendmail
with our stub also called,
sendmail

The way to tell the two apart is by file size. Our stub is only about 40k, whereas the Sendmail binary is of course a lot bigger.

You will find our stub in the temporary unpack directory of the distribution set, dmtemp/sendmail. You should copy it manually over the location of your sendmail binary file, if DMSetup fails to install it.

You should also check that any symbolic links to the sendmail stub, such as the 'mail' command also now point to this stub.

When run, our sendmail stub logs to a file, sendmail.log, in the dsmtp_path directory. So to check that it is being run you would typically examine the file,
/usr/local/dmail/sendmail.log