Configuring Postfix for Linux
For Ubuntu and Debian Install Postfix with the following command:
Or for CentOS:
Open the /etc/postfix/main.cf.
and add the following lines to the end of the file.
Save the main.cf file and close the editor
Configure Postfix SASL credentials
The Gmail credentials must now be added for authentication. Create a /etc/postfix/sasl_passwd file:
and add following line:
The username and password values must be replaced with valid Gmail credentials. The sasl_passwd file can now be saved and closed.
A Postfix lookup table must now be generated from the sasl_passwd text file by running the following command.
Access to the sasl_passwd files should be restricted
Reload the Postfix configuration: