How To Setup FreePBX Email Server For Free using Gmail

Setup FreePBX Email Server

Share This Post

In this tutorial I am going to show you how to setup FreePBX email server for free with a gmail account to send and receive emails within FreePBX without the use of the FreePBX payed email module.

Before we get started you will of course need a free gmail account so go set that up now. If you already have a gmail account you will then need to setup an app password for this to work as an SMTP relay server. *It will not work if you skip this step!

Collect App Password From Gmail

Visit using your gmail id which you plan to use for SMTP relay.

Login using your Gmail username and password, under Google Account click on Security

Enable 2-Step Verification (if not done already). We must enable 2-Step verification to be able to generate App Passwords

Click on Get Started and follow the on screen guide to complete the process. Due to security reasons, the console may prompt you for password multiple times.

Once all the steps are completed, you will be presented with this screen which should contain details of the device your using which you have enabled 2-Step Authentication on. You will also have to login using your code sent to your backup device.

Now under Security section, you should get an option to enable App passwords

Select App passwords and enable one for Mail. You can define any device here, I have defined Windows Computer

Once you click on GENERATE, in the next screen you will get your app password. Make sure to copy this to your clipboard as we will need this in the next steps

Setting Up FreePBX Email

First we need to login to our FreePBX server via SSH. Putty or Termius will work.

We need to open the file. In your SSH session type :

					nano /etc/postfix/

Scroll down till you see :

					# If you're connected via UUCP, see also the default_transport parameter.

Below that line will be the SMTP settings that we need to fill in for gmail to connect. Copy and paste the following settings. Make sure to save and exit when done (control + O to save and control + X to exit)

					relayhost =
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

We need to reload postfix with the following:

					postfix reload

Now we need to create the sasl_password file with our credentials from the first steps that we got from Google. Type :

					nano /etc/postfix/sasl_passwd

Add this line to the file. Make sure to use your email address and your password that we generated earlier. Make sure to save and exit when done (control + O to save and control + X to exit):


Type :

					postmap hash:/etc/postfix/sasl_passwd

Last step is to restart the postfix server with :

					postfix reload

That’s it! You can now use the full functionality of email with FreePBX. Most of our clients here at Fusion-IT like the ability to receive voicemail to email and now you can too within the settings of FreePBX.

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore