Tiny VPS Postfix 11

Minimalistic and Compromise

Finally running my own website, hosting my own blog, having my own server to do whatever I want with it. It is so tempting and logical to setup my own email service running on it. Sending and receiving email with my own server, my own email address with my own domain name … So exciting!!

But wait … Do I really want to do that??

I have more than enough personal email addresses and already looking for ways to merge them.

I already have more than enough work email addresses that have been merged into a single account, which is setup with tones of filters to sort incoming mail into folders.

Do I really want another email account setup on my phone, my desktop, or have to check yet another webmail from browser?

No. Lets take a step back and think again.

What is really needed … for now?

My WordPress blog, the only public website for now, is able to send directly to my personal email. So it does not need an email address.

I do want to receive system message for alerts and daily report. But again, those can be forward to my personal email.

What about a few email addresses under my domain? Hmm … alias/forward them to my personal email too.

So I actually don’t need real email account on this tiny box. But I do need a email server that can handle all the forwarding, with minimal setup!

Minimal Alias/Forward only Email Server

Dealing with postfix daily at work, it is a no-brainer to use it here too. And I only have to change 2 configuration files.


The standard main.cf come with Ubuntu is quite complete.

Modify line 29, 33 according to site setup. Then add line 41 to 57 for basic spam protection and close off open relay. You really don’t want to be an open relay!

Remember to Change MY-HOSTNAME at line 29 and MY-DOMAIN to your own domain at line 33.

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = MY-HOSTNAME
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = MY-DOMAIN, localhost.com, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

smtpd_recipient_restrictions =
reject_rbl_client cbl.abuseat.org,
reject_rbl_client bl.spamcop.net,
reject_rbl_client relays.mail-abuse.org,
reject_rbl_client dnsbl.proxybl.org,
reject_rbl_client truncate.gbudb.net,
reject_rbl_client dnsbl.njabl.org,


Again, to forward system messages and additional email addresses, 3 lines of modification and we are done!

# Mail aliases for sendmail
# You must run newaliases(1) after making changes to this file.
# Required aliases
postmaster: root
MAILER-DAEMON: postmaster

# Common aliases
abuse: postmaster
spam: postmaster

# Other aliases
root: my-gmail-account@gamil.com

# js@johnsiu.com
js: my-gmail-account@gamil.com

# test@johnsiu.com
test: another-account@somewhere-else.com

Then do the following to update aliases.db and restart postfix.

cd /etc
postalias aliases
service postfix restart

That’s it, minimal email server setup to forward all emails to my personal email account!! All I needed for now!

11 thoughts on “Tiny VPS Postfix

  1. Reply pedrosimao May 29,2015 11:21

    Will your tutorial work ff I have different domains in the same VPS server? If yes, how to?
    Thanks a lot!

    • Reply JS Jul 2,2015 05:32

      In line “mydestination = MY-DOMAIN, localhost.com, localhost”, replace “MY-DOMAIN” with your own.

  2. Reply haaho May 4,2013 07:11

    I tried this tutorial but … a mistake came up ” missing = ” on line 42, and what mail is @gamil.com ?

    • Reply JS May 4,2013 21:49

      Will have to check again later tonight . However it was directly from a working setup. On the other hand, can you clarify about @gmail issue?

    • Reply JS May 5,2013 00:54

      Check line 29 and line 33. Especially line 33, I make mistake there before and left an extra comma there and that may have create some configuration file parsing issue.

  3. Reply Dave Mar 15,2013 22:00

    so let me echo this bac so I understand. You don’t send any mail out from this address but anything mailed to the addresses for this domain get routed to you personal email address.
    ie – if this server was myserver.com and I had john@myserver.com as the email address for this server and my personal email address was johnsmith@gmail.com . the change I would make here would be:

    # Other aliases
    root: johnsmith@gmail.com
    john@myserver.com: johnsmith@gmail.com

    And on another note, say you wanted myserver.com to send you server side email notifications – would you configure gmail or another provider to act as your smtp server? And how would you go about doing that?



    • Reply JS Mar 16,2013 11:27

      Hi Dave,

      Yes, with this setup the server is not being using it as an outgoing server. All incoming email to aliases are forward to external personal email address.

      Regarding /etc/aliases, it should be as follow
      root: johnsmith@gmail.com
      john: johnsmith@gmail.com

      The left hand address (local email address) do not need domain part.

      I am using gmail for receiving. All you need is a gmail account. No additional setup on gmail account is needed to receive.

      The advantage of gmail is I can setup to use my server to send outgoing email. I am writing another post on that setup. Should be ready by tomorrow. And as usual, as simple and easy as possible 😀

      • Reply Dave Mar 16,2013 11:49

        I wasn’t sure I’d get a response so quickly! So I went ahead and experimented a bit further and got it all working with just the name without the domain on the left hand side in the aliases file. The other thing I had to do was change the line: mailbox_command = procmail -a “$EXTENSION”
        to: mailbox_command = (ie leaving it blank as postfix can handle it on its own).

        After creating the aliases I ran this first: newaliases

        Now its working on my site (dnpage.ca) and yes I was able to configure gmail to send from that email address but under the covers use the original gmail account.

        Thanks again for the clear concise instructions – they really made it clearer as to what needed to be done!


  4. Reply alexander vergara Feb 11,2013 13:09

    I see, I will try adding several ones. Thank you very much for your reply !

  5. Reply alexander vergara Feb 8,2013 16:18

    Hi, Interesiting post! I have a little question. If I follow this trail, how is possible add the emails counts and set administrative options?Is necessary install something?By other side, when you say “few email addresses under my domain” how many email address is possible to obtain for my domain? Thank you very much

    • Reply JS Feb 8,2013 20:36

      I don’t quite understand email counts or admin options? Maybe you can give some example. Or do you mean something like logwatch? The ‘few email addresses’ actually can be as many as you want, you just keep adding it to the aliases file.

Leave a Reply

%d bloggers like this: