To 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).
Configure Postfix For Relaying
To configure our Postfix server for relaying emails through smtp.example.com, we run
postconf -e ‘relayhost = smtp.example.com’
postconf -e ‘smtp_sasl_auth_enable = yes’
postconf -e ‘smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd’
postconf -e ‘smtp_sasl_security_options =’
Our username (someuser) and password (testpass) for smtp.example.com must be stored in /etc/postfix/sasl_passwd, therefore we do this:
echo “smtp.example.com someuser:testpass” > /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
chmod 600 /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
I sendmail server(remote server)
add the postfix server IP address and hostname in /etc/mail/relay-domains file
/etc/mail/relay-domains
The /etc/mail/relay-domains file is used to determine domains from which it will relay mail. The contents of the relay-domains file should be limited to those domains that can be trusted not to originate spam.
/etc/init.d/sendmail restart