Setup Postfix Manually
Â
Setting Relay Host in Postfix
SSH into system
nano /etc/postfix/main.cf
change relayhost = [ipaddress of smtp server]
postfix reload
Â
Authentication to Postfix
SSH into system
Ânano /etc/postfix/sasl_passwd and add the following line at the bottom of the file.
relayhost username:password
Âthan we need to run the following commands
runÂ
postmap hash:/etc/postfix/sasl_passwdin main.cf add:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =then do postfix reload
refer to http://postfix.state-of-mind.de/patr...ilservers.html for more info
Force postfix to rewrite from address
For ISPs like 1and1 that will reject the message if the from user and the sendingÂ
user don't match you can add these rules to /etc/postfix/generic replacing allÂ
"emailfromaddress@real-domain.com"Â with the real data used above for authentication.root emailfromaddress@real-domain.comÂ
root@localhost emailfromaddress@real-domain.comÂ
root@localhost.localdomain emailfromaddress@real-domain.comÂ
root@freepbx emailfromaddress@real-domain.comÂ
root@freepbx.localdomain emailfromaddress@real-domain.comÂ
asterisk emailfromaddress@real-domain.comÂ
asterisk@localhost emailfromaddress@real-domain.comÂ
asterisk@localhost.localdomain emailfromaddress@real-domain.comÂ
asterisk@freepbx emailfromaddress@real-domain.comÂ
asterisk@freepbx.localdomain emailfromaddress@real-domain.com
vm@asterisk emailfromaddress@real-domain.comTo rewrite the domain for all addresses from the local pbx, use this format in /etc/postfix/generic:
@freepbx.localdomain @real-domain.comÂAdd the following to the end of /etc/postfix/main.cfÂ
smtp_generic_maps = hash:/etc/postfix/genericThen run:
postmap /etc/postfix/generic
service postfix restartÂ
NOTE: This is only needed if the maillog only has lines in it regarding "Connection RESET in response to MAIL FROM"Â
or something similar. This indicates that the mail server is rejecting it based on how we are identifyingÂ
ourselves. This is generally used in conjunction with them setting up a real email box with a real user and usingÂ
the accounts actual email address to send from. Again, this is only really for paranoid mail hosts.