SMTP Postfix Server Setup for your home development

18 Mar


This is much easier if not trivial to achieve with your ISP’s smtp server and configuring postfix as a smart host and simply supplying your ISP’s smtp server as the smart host. A simple:

sudo apt-get install postfix

and then configuring you server as a smart host relaying mail to

If you already installed postfix, you can follow the following:

Note that You might not want to use dnsexit if security is a concern for you. I stumbled upon this now (28 July 2012) and realised that if you use dnsexit, you are basically giving them your credentials. So, be warned. I used my own server for this.


This document describes 5 easy steps to setup your Postfix email server as smarthost to relay on DNS Exit mail relay server for all email sending.

The mail relay service from can be found at here

1. Create password maps file (it assigns username/passwords to
specified mail servers). You can choose any name, let's say it
is /etc/postfix/relay_passwd. It's content should be as follows: USERNAME:PASSWORD 

 Note: Replace USERNAME and PASSWORD with your DNS EXIT mail
relay username and PASSWORD.   

2. Set proper permissions for that file:
# chown root:root /etc/postfix/relay_passwd
# chmod 600 /etc/postfix/relay_passwd     

3. Create hash from maps file (remember to do it each time
you change your maps file):
#  postmap /etc/postfix/relay_passwd   

4. Configure your /etc/postfix/
relayhost = []  # this is the important line!
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
smtp_sasl_security_options =    

Note: If your ISP blocks outgoing port 25. You can choose to
use alternative SMTP ports by appending the port at the end:
relayhost = []:26

5. Reload or restart your postfix:
# /etc/init.d/postfix restart

The thing to note here is that you can easily use your ISP’s smtp server as the relayhost. You can find out easily what your ISP’s smtp server is by going to their support pages.


Posted in Howto, Linux


Leave a Reply


  1. Set Up Postfix to Solve Blocked Port 25 Issue, and Send Emails from Localhost. | Buzu’s Oficial Blog

    19/04/2012 at 10:27 pm

    [...] Where I found the answer to the problem. I must admit that before trying this out, I continued wasting time trying some other stupid things, like the aforementioned about localdomain as relyhost. Why? Pure lazines. I didn’t want to follow through the steps outlined on that post. Shame on me! [...]

  2. nemesis

    25/11/2012 at 11:46 am

    Thanks, my institution blocked the port 25 for outgoing mail and this tutorial worked like a charm!