Skip to content

Postfix SMTP Mail Relay Server (on Ubuntu 8.04)

December 3, 2008

Here is how to configure Postfix to relay all incoming mail to another mail server (main mail server)

1. Edit
#mydestination = $mydomain
relayhost =
relay_domains = $mydomain
virtual_alias_maps = hash:/etc/postfix/virtual
relay_recipient_maps = hash:/etc/postfix/relay_recipients
local_recipient_maps =
transport_maps = hash:/etc/postfix/transport

2. You should create and hash tree files:
virtual –> virtual users mailbox
relay_recipients –> accepted relay addresses
transport –> smtp transport address
Just like this:

# user mail
— /virtual —

— relay_recipients
# mail stat OK
— /relay_recipients —

# domain smtp forward smtp:[]
— /transport —

3. Hash all these tree files:
cd /etc/postfix
postmap virtual
postmap relay_recipients
postmap transport

after correct hashing you should have three files.db

4. Reload postfix /etc/init.d/postfix reload

5. See SMTP traffic log in front mail server and mail server. e.g: tail -f /var/log/mail.log

6. Enjoy :)

From → linux

One Comment
  1. Mac permalink

    This was helpful. Thanks for taking the time and sharing.

Leave a Reply

Fill in your details below or click an icon to log in: 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

<span>%d</span> bloggers like this: