Welcome to Geek Times!
spacer
Mac OS X: Configuring sendmail
Find on this site:


home
search
archive
about

.
One of the things for which I use my Mac OS X boxen for is to manage my own email and to provide email service to my friends and relatives (so they have an unchanging domain name). To that end I've had to install sendmail (described here) and qpopper.

This work is to be done on the computer which is to be your mail server. You may sit at that computer's keyboard or work remotely.

These UNIX commands have been taken directly from a Terminal window - these are the commands I use - rather than having been composed after the fact. This is *exactly* what worked for me. I've taken pains to choose forms of the commands which should make sense to you even if you're new to UNIX.

Sendmail comes with your Mac OS X installation. The first thing to do is create a script to automate the re-initialization of sendmail when you configure it.

sendmail-update

The sendmail-update script is from http://www.macdevcenter.com/pub/a/mac/2002/09/10/sendmail.html.

#! /bin/sh

if [ /etc/mail/config.mc -nt /etc/mail/sendmail.cf ] then echo Regenerating sendmail.cf m4 /usr/share/sendmail/conf/m4/cf.m4 /etc/mail/config.mc > /tmp/sendmail.cf mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.old mv /tmp/sendmail.cf /etc/mail/sendmail.cf /System/Library/StartupItems/Sendmail/Sendmail restart fi

if [ /etc/mail/aliases -nt /etc/mail/aliases.db ] then echo Updating aliases newaliases fi

if [ /etc/mail/access -nt /etc/mail/access.db ] then echo Updating access makemap hash /etc/mail/access < /etc/mail/access fi

I place this script (and my own creations) into ~/bin (which is on my search path). If you place it elsewhere you'll have to change my references to ~/bin/sendmail-update as appropriate.

PLACEHOLDER

% chmod g+x ~/bin/sendmail-update 
% sudo cp /usr/share/sendmail/conf/cf/generic-darwin.mc /etc/mail/config.mc
% sudo vi /etc/mail/config.mc
% rehash
% sudo ~/bin/sendmail-update 
Regenerating sendmail.cf
% vi ~/bin/sendmail-update
% sudo ~/bin/sendmail-update
% sudo /System/Library/StartupItems/Sendmail/Sendmail start
% sudo vi /etc/hostconfig

PLACEHOLDER

% telnet localhost 25 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mickey.geektimes.com ESMTP Sendmail 8.12.9/8.12.9; Wed, 7 Jul 2004 02:40:15 -0700 (PDT) QUIT 221 2.0.0 mickey.geektimes.com closing connection Connection closed by foreign host. [mickey:~] mickey%

% ps -ax | grep sendmail 374 ?? Ss 0:00.11 /usr/sbin/sendmail -bd -q1h 377 ?? Ss 0:00.01 /usr/sbin/sendmail -C /etc/mail/submit.cf -q1h 427 ?? S 0:00.01 /usr/sbin/sendmail -bd -q1h 446 std S+ 0:00.00 grep sendmail [mickey:~] mickey% !! ps -ax | grep sendmail 374 ?? Ss 0:00.11 /usr/sbin/sendmail -bd -q1h 377 ?? Ss 0:00.01 /usr/sbin/sendmail -C /etc/mail/submit.cf -q1h 427 ?? S 0:00.01 /usr/sbin/sendmail -bd -q1h 448 std R+ 0:00.00 grep sendmail [mickey:~] mickey% sudo kill -HUP 374 [mickey:~] mickey% sudo kill -HUP 427 [mickey:~] mickey% !ps ps -ax | grep sendmail 377 ?? Ss 0:00.01 /usr/sbin/sendmail -C /etc/mail/submit.cf -q1h 450 ?? S 0:00.02 /usr/sbin/sendmail -bd -q1h 452 ?? Ss 0:00.01 /usr/sbin/sendmail -bd -q1h 457 std R+ 0:00.00 grep sendmail [mickey:~] mickey%

% sudo niutil -create . /locations/sendmail [mickey:~] mickey% sudo niutil -createprop . /locations/sendmail sendmail.cf /etc/mail/sendmail.cf %

% sudo vi /etc/mail/config.mc --> define(`LUSER_RELAY', `local:mickey') % sudo ~/bin/sendmail-update Regenerating sendmail.cf Restarting mail services %

% sudo vi /etc/mail/config.mc #undefine(`ALIAS_FILE') define(`ALIAS_FILE', `/etc/mail/aliases') % sudo ~/bin/sendmail-update Regenerating sendmail.cf Restarting mail services %

% sudo vi /etc/mail/aliases % cat /etc/mail/aliases root: mickey webmaster: mickey postmaster: mickey % sudo newaliases /etc/mail/aliases: 3 aliases, longest 6 bytes, 41 bytes total %

You might want to - okay, you really ought to - jump up one level, to see how this fits into the big picture of deploying a mail server.

This page is copyrighted 1993-2006 by Michael 'Mickey' Sattler, some rights reserved via the Creative Commons License. Questions and comments? Send email to the Geek Times Webmaster. (Domain and web content hosting at 1and1.)
email