Setting up Sendmail for a home mail server

Posted Thursday, September 20th 2012 in FreeBSD - Permalink

FreeBSD comes pre-installed with sendmail. This is an old program which sends and receives emails. Configuring it for use as a home email server is quite simple.

The first thing that you need to do is make sure that it is enabled to start on boot. Edit /etc/rc.conf and add the line


Next, we need to configure sendmail to send and receive email. This will require editing /etc/mail/ The first thing to do is to specify which domains we should accept email for. Add these to the end of the Cwlocalhost line, e.g.


Incoming email reaching our server with a domain not included in this list will be relayed.

If this is a home server, the ISP most likely assigns your IP address dynamically. This can cause a problem, as many major email services do not accept mail from dynamic IP addresses. To get around this, many ISPs allow you to relay your mail through their mail servers, which are generally accepted by other mail servers. For example, if the SMTP server for you ISP is, you will want to enter or modify the following line:

Make sure that there is not a space between DS and the SMTP server name.

You should now be able to send mail and receive mail, for example using the command-line mail client mutt.

The next step is to prevent unauthorized mail relaying. We don’t want spammers to find out that we are open to relay any email, as spam from them, relayed through us, would be attributed to us. Modify the file /etc/mail/access and add lines such as

192.168.0                       RELAY                    RELAY

This will allow relaying for any host in our local network, and also allow relaying for the host, for example your email client at work.

Once this is completed, we start or restart sendmail,

# /etc/rc.d/sendmail start

List Posts Newest Posts Page 1Next Page