HOWTO :’s Relay Mail Server with Postfix on Ubuntu Server

Your Internet Services Provider (ISP) may block SMTP port (Port 25) if you are not using a business plan (like in Hong Kong). However, you can still send email with reverse lookup of your domain name when your domain registrar is

Step 1 :

Create and enable your free email account at when you have a domain name there. Set the password accordingly. Your username of the account may be look like this : yourname@yourdomain.

Incoming Mail Server Type : POP3
Incoming Mail Server :
Incoming Mail Server Port : 110

Outgoing Mail Server :
Outgoing Mail Server Port : 25, 80, 587 or 3535

Step 2 :

Create a file namely “sasl_passwd“.

sudo nano /etc/postfix/sasl/sasl_passwd

Add the following line. username:password

Step 2a :

Save and quit. Issue the following commands.

chown root:root /etc/postfix/sasl/sasl_passwd
chmod 600 /etc/postfix/sasl/sasl_passwd
postmap /etc/postfix/sasl/sasl_passwd

Step 3 :

Go to your mail server (Postfix).

sudo nano /etc/postfix/

Edit or/and add the following lines.

relayhost = []
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_sasl_security_options = noanonymous
mynetworks =, [::ffff:]/104 [::1]/128

*If your network is, otherwise; change it accordingly.

Step 4 :

Restart the Postfix to make it work.

sudo /etc/init.d/postfix restart

Step 5 :

Now, you can send email with reverse lookup via’s relay mail server. Your email will not be blocked or redirected to “Junk Mail” folder by Gmail, Yahoo Mail or others.

Be keep in mind that you have 250 quota every day. Or, you are required to purchase more quota.

Point to your email server on other servers that will send email.

4 Responses

  1. […] samiux wrote an interesting post today onHOWTO :'s Relay Mail Server with Postfix on Ubuntu <b>…</b>Here’s a quick excerpt […]

  2. I am migrating my apps to Amazon EC2 and needs the godaddy email relay to send out emails (see my chronicle at I followed the exact steps here but the mail still stucks in the queue). Here is my configs:

    myhostname = mydomainhere
    mydomain = mydomainhere
    myorigin = $mydomain

    smtpd_banner = $myhostname ESMTP $mail_name
    biff = no
    append_dot_mydomain = no

    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination = localdomain, localhost, localhost.localdomain, localhost
    mynetworks =
    mailbox_size_limit = 0
    recipient_delimiter = +

    # SECURITY NOTE: Listening on all interfaces. Make sure your firewall is
    # configured correctly
    inet_interfaces = all

    relayhost =
    smtp_connection_cache_destinations =
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
    smtp_sasl_security_options = noanonymous

    default_destination_concurrency_limit = 4

    soft_bounce = yes

    Any ideas? Thanks.

  3. Sheldon Shi,

    I am also interested in Amazon EC2; however, I have no time and no idea to try.

    I think the “relayhost=” should look like this :


  4. Excellent post! I had setup some sendmail configurations previously, many years ago. I wanted to setup postfix on my Mac Pro notebook running Mac OS X 10.6 (Snow Leopard) and was getting bogged down with the details of postfix configuration. The Ubuntu notes worked for me, since OS X is a true *nix, after all. BTW, I specified:


    I thought I had seen that somewhere before, and recalled notes about many mail relays blocking port 25 (too obvious to spam, I guess?)

    p.s. I usually use iMail for receiving and sending mail, but I also wanted to be able to send from command line and/or programs/scripts using the mail command.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: