Set Up Postfix For Relaying Emails Through Another Mailserver
Set Up Postfix For Relaying Emails Through Another MailserverVersion 1.0 This short guide shows how you can set up Postfix to relay emails through another mailserver. This can be useful if you run a Postfix mailserver in your local network and have a dynamic IP address because most dynamic IP addresses are blacklisted today. By relaying your emails through another mailserver that is hosted on a static IP address in a data center (e.g. your ISP's mailserver) you can prevent your emails from being categorized as spam. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
1 Preliminary NoteTo configure relaying on your Postfix mailserver, you need a valid email account (with username and password) on another mailserver (provided that this mailserver makes use of SMTP-AUTH (which it should do)). This other mailserver should be hosted on a static IP address in some data center (e.g. your ISP's mailserver). In this guide I use smtp.example.com as the remote mailserver on which I have a valid email account with the username someuser and the password howtoforge. I assume you have already installed Postfix as I won't go into the details of installing Postfix here.
2 Configure Postfix For RelayingTo configure our Postfix server for relaying emails through smtp.example.com, we run postconf -e 'relayhost = smtp.example.com' Our username (someuser) and password (howtoforge) for smtp.example.com must be stored in /etc/postfix/sasl_passwd, therefore we do this: echo "smtp.example.com someuser:howtoforge" > /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd must be owned by root, and noone else should have read access to that file, so we do this: chown root:root /etc/postfix/sasl_passwd Now we must convert /etc/postfix/sasl_passwd into a format that Postfix can read: postmap /etc/postfix/sasl_passwd This will create the file /etc/postfix/sasl_passwd.db. All that is left to do is restart Postfix: /etc/init.d/postfix restart That's it. You can now test by sending emails over your mailserver and having a look at your mail log. You should see that all your emails are now passed on to smtp.example.com (except the ones that have a local recipient).
3 Links
|







Recent comments
2 days 23 hours ago
3 days 2 hours ago
4 days 16 hours ago
5 days 10 hours ago
5 days 10 hours ago
5 days 13 hours ago
1 week 22 hours ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago