FreePBX Email Notifications 📧

A quick guide on setting up outbound emails from FreePBX - without needing to pay for the commercial System Admin module!

FreePBX Email Notifications 📧

Setting up SMTP email notifications in FreePBX can't be set up from the UI without the commercial 'System Admin' module. The good news is, it can be set up manually with hardly any fuss!

Email Setup

  • SSH into the system
  • Edit '/etc/postfix/main.cf'
relayhost = [mail.mailserver.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_generic_maps = hash:/etc/postfix/generic
/etc/postfix/main.cf
  • Edit '/etc/postfix/sasl_passwd'
[mail.mailserver.com]:587 username@domain.com:password123
/etc/postfix/sasl_passwd

Force postfix to rewrite from address, inside '/etc/postfix/generic'

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.com
/etc/postfix/generic

To rewrite the domain for all addresses from the local pbx, use this format in '/etc/postfix/generic':

@freepbx.localdomain @real-domain.com
/etc/postfix/generic
  • Set permissions 'chmod 400 /etc/postfix/sasl_passwd'
  • Run 'postmap hash:/etc/postfix/sasl_passwd'
  • Change owner 'chown postfix /etc/postfix/sasl_passwd'
  • Reload postfix: '/etc/init.d/postfix reload'

And that's it - you can now receive emails for voicemail or outbound route notifications!

I use emails from FreePBX to notify me when the USA routing is used:

FreePBX Email Notifications