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 main.cf
#mydestination = $mydomain
relayhost = your.main.mail.server.com
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:

virtual
# user mail
info info@mymail.address.com
— /virtual —

— relay_recipients
# mail stat
info@mymail.address.com OK
— /relay_recipients —

transport
# domain smtp forward
mymail.address.com smtp:[your.main.mail.server.com]
— /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 :)

Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: