Sendmail OSX part 3

local mailboxes with qpopper

local mailboxes with qpopper




h2. local mailboxes with qpopper

Part 3: local mailboxes with qpopper

This option will work on both OSX and OSX Server.


The delivery mechanism here is common in the Unix world. Sendmail passes local message to procmail, a small application that creates files inside /var/mail with the name of the recipient user on the local system. Each file can be easily read with a text editor or a POP server (such as qpopper) for delivery to the client workstation. There are also IMAP servers freely available.


If you need to perform processing on the contents of an email (such as who sent it or whether it contains certain attachments), procmail has a rich set of commands. You should remember that sendmail does not look at the contents of an email, but procmail can.



# cd ~
# curl -O ftp://ftp.eudora.com/eudora/servers/unix/popper/qpopper4.0.4-no-test.tar.gz
# gunzip qpopper4.0.4-no-test.tar.gz
# tar -xvf qpopper4.0.4-no-test.tar
# cd qpopper4.0.4
# ./configure --enable-standalone
# su
# make
# cp popper/popper /usr/sbin/

Some people have asked why I run qpopper in this fashion rather than through inetd. I believe that running standalone might be more efficient for larger sites where clients are configured to check email every couple of minutes. You aren’t lauching qpopper every time it is needed. However using inetd will also work.

Edit /System/Library/StartupItems/Sendmail/Sendmail


#!/bin/sh
. /etc/rc.common ##
  1. Start mail server ##

    if [ “${MAILSERVER:=-NO-” = “YES“ ]; then
    ConsoleMessage “Starting mail services”

    1. Remove junk from the outbound mail queue directory and start up
    2. the sendmail daemon. /usr/spool/mqueue is assumed here even though
    3. it can be changed in the sendmail configuration file. ##

      queue=/var/spool/mqueue

      rm -f ${queue}/nf* ${queue}/lf*
      /usr/sbin/sendmail -bd -q1h
      /usr/sbin/popper
      fi

Notice the line we added at the end to start popper.

Create /etc/mail/mailertable. This file tells sendmail to deliver in the normal manner to local domains:


yourdomain.com.au local:
anotherdomain.com.au  local:


OK. Now we can create the configuration file and we are all done. Be careful again here with line breaks. Each line begins with a command like "define" or "feature", even though your browser may have wrapped the text differently.


Create /etc/mail/sendmail.mc



###
	
  1. This basic sendmail.mc file provides basic sendmail service
  2. which is still a vast improvement over the built-in Apple
  3. Mail Server.
#
  1. After any change made here, execute this:
  2. cd /usr/share/sendmail/conf/m4
  3. m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf ###

    include(`/usr/share/sendmail/conf/m4/cf.m4’)

    VERSIONID
    OSTYPE
    DOMAIN
    define(`PROCMAIL_MAILER_PATH’,`/usr/bin/procmail’)
    define(`confTRY_NULL_MX_LIST’,true)
    define(`_USE_ETC_MAIL_’,true)
    define(`confSMTP_LOGIN_MSG’,”$j ; $b”)
    define(`confMAX_DAEMON_CHILDREN’,15)
    define(`confPRIVACY_FLAGS’,``noexpn,authwarnings,novrfy,goaway’‘)

    FEATURE
    define(`confCW_FILE’, `-o /etc/mail/local-host-names’)
    FEATURE
    FEATURE
    FEATURE
    FEATURE
    FEATURE
    FEATURE
    FEATURE

    MAILER
    MAILER
    MAILER

Feel free to delete the spam prevention line if you don’t like the thought of possibly losing some legitimate email from badly configured servers that are open relay.


Now move on to the “final step”:node/131.