Setup Outbound SMTP for FreePBX Servers
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_passwd
in 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
"This email address is being protected from spambots. You need JavaScript enabled to view it. " with the real data used above for authentication.
rootThis email address is being protected from spambots. You need JavaScript enabled to view it.
root@localhostThis email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it.
root@freepbxThis email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it.
asteriskThis email address is being protected from spambots. You need JavaScript enabled to view it.
asterisk@localhostThis email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it.
asterisk@freepbxThis email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it. This email address is being protected from spambots. You need JavaScript enabled to view it.
vm@asteriskThis email address is being protected from spambots. You need JavaScript enabled to view it.
To rewrite the domain for all addresses from the local pbx, use this format in /etc/postfix/generic:
@freepbx.localdomainThis email address is being protected from spambots. You need JavaScript enabled to view it.
Add the following to the end of /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Then 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.
- relayhost username:password