Home -- Tutorials -- Quickies -- Manual Pages -- Search -- Feedback -- About The Site -- Forum
Setting Up Home Directory Mail Spooling
added 1.26.1999 -- written by Ted Wisniewski


Article Description: This tutorial will help you to setup home directory mail spooling using Procmail, Sendmail and the University of Washington's POP and IMAP servers.
The reasons to do "Home directory" spooling are many.

Here are a couple of really good reasons:
  • All user files will be in one place, less system administration
    to maintain.

  • 1 filesystem with quotas (as opposed to have one for user
    files and another for mail)


  • What you will need:
  • Procmail (to be used as a local delivery agent) the current version (at time of writing) is procmail-3.11pre7.tar.gz and can be retrieved from ftp.informatik.rwth-aachen.de in the /pub/packages/procmail directory.

  • Sendmail version 8.9.1 or better.  This can be retrieved from ftp.sendmail.org in the /pub/sendmail directory.

  • Mail readers Elm/Pine (installed as packages) and POP/IMAP mail servers
    (installed from source).


  • Now that you have the two essential pieces of software we need to extract the files, build and install them.

    Procmail –
  • cd /var/tmp

  • tar zxvf procmail-3.11pre7.tar.gz

  • cd procmail-3.11pre7/src

  • Edit the authenticate.c file and uncomment the following line:


  • /*
    The first two characters on the line need to be removed, it should
    look like (below) when done.



  • cd ..

  • make

  • (as the root user) make install-suid

  • ln –s /usr/bin/procmail /usr/local/bin/procmail


  • Sendmail –
  • cd /var/tmp

  • tar zxvf sendmail.8.9.1.tar.gz

  • cd sendmail.8.9.1

  • make

  • (as the root user) make install

  • Now a "sendmail.cf" file must me generated for the host, the
    one that came with the system is not adequate for our needs (we need to
    use sendmail as the delivery agent to get the mail spooled into the users’
    home directory).

  • cd cf/cf and edit the file called generic-bsd4.4.mc


  • add the following "Features"
    FEATURE(local_procmail)
    FEATURE(relay_entire_domain)
    FEATURE(relay_local_from)

    Remove the following line:
    MAILER(local)dnl
  • make generic-bsd4.4.cf

  • cp generic-bsd4.4.cf /etc/sendmail.cf

  • vi /etc/sendmail.cw, If this file does not already exist, create it, and for each "name" your host has put and entry for that hostname.


  • Example contents of /etc/sendmail.cw file:
    mail.domain.com
    mail.otherdomain.com
    otherdomain.com
    domain.com

  • cat /var/run/sendmail.pid, the listed number (PID) is the process ID of the currently running sendmail daemon, do kill –9 PID, where PID is that number.

  • Restart sendmail: /usr/sbin/sendmail –bd –q30m


  • Now, You must tell your mail-readers where the mail is
    now spooled, most of them assume /var/mail or some other centralized
    place.


    For (using csh or tcsh) "elm" and "mail" they respect
    the "MAIL" environment variable.  You can set it in /etc/csh.cshrcas follows:

    setenv MAIL ~/.mail

    For pine, you need to edit your system-wide Pine configuration file
    usually /usr/local/etc/pine.conf and add:
    inbox-path=~/.mail

    For POP/IMAP mail readers, you will need to download the source for
    the latest University of Washington POP/IMAP server from ftp.cac.washington.edu in the /imap directory.

    Extract the archive: tar -zxvf imap-version.tar.Z
    You need to make 1 modification to imap-version/src/osdep/unix/env_unix.c, comment out or remove the line indicated below add/replace that line with the one provided.

    char *sysinbox ()
    {
      char tmp[MAILTMPLEN];
      if (!sysInbox) {             
    /* initialize if first time */
        /*sprintf (tmp,"%s/%s",MAILSPOOL,myusername ());    

    /*REMOVE*/
        sprintf
    (tmp,"%s/%s",myHomeDir,"/.mail");                      
    /*ADD*/
        sysInbox = cpystr (tmp);    /* system inbox is from mail spool */
      }
      return sysInbox;
    }


    Then build the POP3 and IMAP servers by doing "make bsf" in the imap-version directory.

    Upon completion of the build do the following as root (I assume you
    have backed up older versions if you are overwriting older executables):

    cp imapd/imapd /usr/local/bin/imapd
        chmod 755 /usr/local/bin/imapd
    cp ipopd/ipop3d /usr/local/bin/ipopd
        chmod 755 /usr/local/bin/ipopd

    Now edit /etc/inetd.conf and make sure your pop3 & imap entries
    appear like:

        pop3    stream  tcp    nowait  root    /usr/local/bin/ipop3d   ipop3d
        imap    stream  tcp    nowait  root    /usr/local/bin/imapd   imapd


    If /etc/inetd.conf requires editing, you will need to "kill
    -HUP"
    the inetd process ("kill -HUP  `/var/run/inetd.pid`").
    © Copyright 1998-2008 VANGEYN.Net, unless otherwise noted.