Home FreeBSD FreeBSD: postfix mail server

FreeBSD: postfix mail server

by Kliment Andreev
0 comment
Reading Time: < 1 minute

A newer and more detailed version -> here.

When I replaced my old desktop FreeBSD router/gateway, I also decided to replace the MTA (mail transport agent). I was using qmail for a while and never had any problems. I figured it’s time to replace qmail because it’s no longer supported by its author and there are some fetaures that I might need in near future that qmail doesn’t support (IPv6 for example).

FreeBSD comes with sendmail installed but I think that this is the most difficult program to work with. The configuration file is cryptic and very confusing. So I decided to go with postfix. Installation and configuration is very easy. First, let’s install it.

cd /usr/ports/mail/postfix
make all install clean

Then, edit /etc/rc.conf and add the following lines:


We should remove some periodic processes that were part of sendmail as well. Edit /etc/periodic.conf and add the following lines:

# postfix & sendmail maintenance

I also want root’s email to be forwarded to my other account, so I edited /etc/aliases, uncommented the line that says root: you and replaced you with my login name. Remember to update the aliases database with /usr/local/bin/newaliases. postfix comes with a configuration file in /usr/local/etc/postfix/main.cf. The only thing that I changed were the following lines:

myhostname = tripnotic.chombe.org
mydomain = chombe.org
myorigin = $mydomain
mynetworks =,,,
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

You can read the meanings of these lines in the comments in the file. They are very self-explanatory. Once I am done with postfix, let’s get rid of running sendmail and start postfix.

killall sendmail
sh /usr/local/etc/rc.d/postfix start

If you make any changes in main.cf use postfix reload instead of postfix stop && postfix start. When you send or receive e-mails, you can check if everything is OK with

tail -f /var/log/maillog. 
0 comment

Related Articles

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More