Hi Thirupan,
I have seen that you already have the certificate, perfect. The first thing you should know is that this certificate only works on the OS on which it was created so, if you are using the virtual machine with these certificates let's do the Postfix server here. I would like to share with you this guide that I built for this purpose over Ubuntu where we are using the Gmail service.
1. Open the terminal as root.
2. Install the packages apt install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules.
3. Once the command execution has finished, the Postfix installation menu should appear. In this menu, the No configuration option must then be selected. The image shows an example of this.
4. Then we will copy the schematic configuration in specific path with command
cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf. Before, we will validate that main.cf.debian exist.
5. At this point, the configuration file
/etc/postfix/main.cf must be edited with the mail server information. The image below shows an example
Before saving the configuration, we need to validate that ca-certificates.crt exists on the path. If not exist, an error will occur in Postfix.
6. Next, we should execute these commands as root.:
echo [
smtp.gmail.com]:587 USER...@gmail.com:PASSWORD > /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
chmod 400 /etc/postfix/sasl_passwd
chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
systemctl restart postfix
Where:
The image shows the execution
7. Is very important to
Enable “Less Secure Apps” for Gmail (Link). If you don't do Gmail locks access to Postfix and email never will send.
8. Finally we are ready to send the mail with Postfix therefore, we should execute the command:
I validated that works well. I would like to left you an image with the Postfix test.
I followed this page to do this tutorial.
Best regards
Hanes