Setting up a basic single domain postfix mail server was not as difficult as I imagined. Configuring a postfix mail server is not rocket science, and here is what I did to configure postfix for my WordPress blog.
The Book
I highly recommend The Book Of Postfix published by No Starch in 2005. A reviewer on Amazon says it is better than the O’Reilly Postfix book, and I agree even if I didn’t read that O’Reilly book. After reading the first two chapters, I was able to configure a basic Postfix mail server.
What’s very important, as the book says, is preparing the host for Postfix.
Preparation
In my case, I need to setup hostname and DNS MX records correctly from the onset.
- Setting the hostname. To set hostname in Debian, edit
/etc/hostnameand putthinkweird.infoas my hostname. - Install
dnsutilsto for dig command. To check and modify DNS records,digcommand will come in handy. - Modify DNS information. Find out the DNS MX records for my domain
dig thinkweird.info MX. I use the DNS server of Godaddy.com, and I use itstotal domain controlto modify my DNS MX record intothinkweird.info. Once correctly configured,digshows this record: - Install
bsd-mailxto havemailcommand to test postfix. It is better than telnet method.
thinkweird.info. 1800 IN MX 10 thinkweird.info.
Install and Configure
For mail transfer functions of WordPress, I don’t need complications and installing postfix is suffice. A few steps prompted by debconf is enough to get the mail system working for WordPress. For now, I only want WordPress to use postfix on localhost, and disable the access of postfix from the rest of the world. I am not sure what to do to disable the feared Open Relay, but it seems the following lines in the main.cf do the trick:
mydestination = thinkweird.info, localhost, localhost.localdomain, localhost relay_domains = $mydestination mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
The line relay_domains = $mydestination tells postfix only to relay mail for my own destinations.
Check if the Open Relay is enabled
Open Relay is the mail server admin’s nightmare.
Test the mail server domain at abuse.net to see if Open Relay is enabled for postfix or not.