Configuring Sendmail Part 2
Sendmail is a trademark of Sendmail, Inc. and is an open source email server. It is normally pretty complicated to install, and the documentation seems to be written by experts and generally confuses the novice system administrator. In this section, we will walk you through installing and configuring it. More information can be found by visiting the sendmail website. Sendmail comes pre-installed in FreeBSD, so we don't need to specifically install it. We do need to install some helper applications and configure sendmail for proper operations.
This is part two of the configuration. If you have not followed part one, you need to do so.
Create submit.mc file
Next, create the sendmail.submit.mc file which will be compiled into the sendmail.submit.cf file.
NOTE: Be careful with the "word wrap" of lines in the above file. Turn off Word Wrap.
# cat > /etc/mail/submit.mc
copy and paste the following into the prompt. Hit CTRL-D when done.
divert(-1)
#
# Copyright (c) 2001, 2002 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
#
# This is the prototype file for a set-group-ID sm-msp sendmail that
# acts as a initial mail submission program.
#
divert(0)dnl
VERSIONID(`$Id: submit.mc,v 8.6.2.4 2002/12/29 03:54:34 ca Exp $')
define(`confCF_VERSION', `Submit')dnl
define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining
define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet
define(`confTIME_ZONE', `USE_TZ')dnl
define(`confDONT_INIT_GROUPS', `True')dnl
define(`confCT_FILE', `/etc/mail/trusted-users')dnl
FEATURE(`use_ct_file')dnl
dnl
dnl If you use IPv6 only, change [127.0.0.1] to [IPv6:::1]
FEATURE(`msp', `[127.0.0.1]')dnl
Don't forget to hit CTRL-D to save the file.
Finishing Up
# nano aliases
root:<tab> This e-mail address is being protected from spambots. You need JavaScript enabled to view it
and save.
Now we build our changes.
# make all
Confirm that sendmail is enabled in the /etc/rc.conf file, if not, add it:
# nano /etc/rc.conf
sendmail_enable="YES"
# telnet 192.168.1.1 25
You should get a connection. If you get connection refused, restart your server with # restart -r now and try it again. If it still doesn't work, look at the log file for errors. The most common errors would be in the sendmail.mc or submit.mc files, so check those carefully looking for evidence of word wrap in your paste (hint, most lines end with a dn1)
Reading Sendmail log files
# cd /var/log
# bzcat bzcat maillog.0.bz2
Ok, so now we have a properly running sendmail system. By default, Sendmail will put user's mail in their home directory under a .mail subdir (/home/<user>/.mail . This is not always ideal, as it requires a local account for each email recipient and does not work well if you host more than one domain.
In the next section, we will explore using maildir format which allows for virtual users.