If you are using Google Cloud Platform then you might already know that Google blocks SMTP port 25. Even if you set up your mail server somewhere else, you can not use SMTP port 25 in your web applications.
And Google also discourages setting up mail services on GCP and recommend to use their third-party partners. In case you are planning to set up your own mail server, this guide is for you. First, you need to follow the guide below to make sure your server is ready to send emails (this server can be hosted by any provider, assuming they do not block email ports).
Achieve 10/10 Email score with CyberPanel!
I assume that after reading the article mentioned above, you are done with your email setup that includes setting up SPF, DMARC and DKIM signing. To issue SSL for MailServer is also mentioned in the last article, but it is important step, so this should be our first step here.
To issue SSL for MailServer choose a domain which you are going to use as SMTP host in your web application, this is just a good practice. Also, your reverse DNS record should point back to this domain name.
Go to https:/:8090/manageSSL/sslForMailServer
There you can issue SSL for MailServer.
To send emails via your mail server in your web application, you need to have some way of authenticating to your SMTP. For that, we need to create an email account.
The email you create on this page will be our entry point to this mail server. As we will be using this email and its password to authenticate to this mail server.
As I’ve mentioned above that Google blocks standard email ports, you can ask your server to listen on non-standard SMTP port such as 2525.
Open /etc/postfix/master.cf, and just after smtp inet n – n – – smtpd paste:
2525 inet n - n - - smtpd
This will make postfix listen on port 2525, you can choose any non-standard email port here. You can use the command below to make sure port 2525 is listening for connections.
It is time you configure your web application to send emails via this mail server. You can use following parameters:
|SMTP Host||Domain for which you issued MailServer SSL.|
|SMTP User||Email that you just created.|
|SMTP Password||Password for the above email.|
Replace port with the port you choose. Your web application cannot send emails through