Postfix for WordPress

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.


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/hostname and put as my hostname.
  • Install dnsutils to for dig command. To check and modify DNS records, dig command will come in handy.
  • Modify DNS information. Find out the DNS MX records for my domain dig MX. I use the DNS server of, and I use its total domain control to modify my DNS MX record into Once correctly configured, dig shows this record:
  • 1800 IN MX 10

  • Install bsd-mailx to have mail command to test postfix. It is better than telnet method.

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 do the trick:

mydestination =, localhost, localhost.localdomain, localhost
relay_domains = $mydestination
mynetworks = [::ffff:]/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 to see if Open Relay is enabled for postfix or not.

Leave a Reply

Your email address will not be published. Required fields are marked *