Bobcares

Postfix on Plesk server on Google Cloud using SendGrid

Want to configure Postfix on the Plesk server on Google Cloud? We can help you

It is quite common that we may receive incoming mail. However, the outgoing messages get stuck in the queue.

As part of our Google Cloud Platform Services, we assist our customers with several Google Cloud queries.

Today, let us see how we can add Postfix on the Plesk server on Google Cloud.

 

Send email from a Plesk server on Google Cloud

To configure sending emails, we need to use one of the following solutions:

  • Use one of Compute Engine’s third-party partners to set up and send emails through their servers.
  • Use a G Suite account to set up a relay service to send emails through it.

By default, Google Compute Engine blocks the SMTP ports, 25, 465, and 587. It does not allow outbound connections on them.

In such a case, Instances can receive emails. However, it does not allow sending emails from these ports.

 

Postfix on Plesk server on Google Cloud

Moving ahead, let us discuss how to configure Postfix on the Plesk server to send emails using SendGrid.

  1. Initially, we connect to the server via SSH.
  2. Then we define the MTA on the server and switch to Postfix if necessary.
  3. Later, we create a backup of the original /etc/postfix/main.cf configuration file and open it in a text editor:
    # cp -a /etc/postfix/main.cf{,.original}
    # vi /etc/postfix/main.cf
  4. Adjust it in accordance with the Google documentation instructions.

Then we check if the following parameters exist and comment them out by adding a hashtag sign to its beginning:

default_transport = error
relay_transport = error

Comment it out like this:

#default_transport = error
#relay_transport = error

We add the SendGrid SMTP service as relayhost:

relayhost = [smtp.sendgrid.net]:2525

Here, we use port 2525 because Compute Engine does not allow outbound connections on ports 25, 587.

Then we add the following lines at the end of the file:

smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
header_size_limit = 4096000
smtp_sasl_security_options = noanonymous

Once we set the parameters, we ensure that there are no duplicate directives that can break the configuration:

# cat /etc/postfix/main.cf | grep 
“relayhost\|smtp_tls_security_level\|smtp_sasl_auth_enable\|smtp_sasl_password_maps\|header_size_limit\|smtp_sasl_security_options”

In case we find any, we comment out/remove them.

Then we generate the SASL password map:

# echo [smtp.sendgrid.net]:2525 yourSendGridUsername:yourSendGridPassword >> /etc/postfix/sasl_passwd

We use the postmap utility to generate a .db file:

# postmap /etc/postfix/sasl_passwd

We can verify the creation of the .db file using:

# ls -l /etc/postfix/sasl_passwd*
-rw——- 1 root root … /etc/postfix/sasl_passwd
-rw——- 1 root root … /etc/postfix/sasl_passwd.db

To set the proper permissions on .db file, we run:

# chmod 600 /etc/postfix/sasl_passwd.db

Then we remove the file containing SendGrid credentials:

# rm /etc/postfix/sasl_passwd

Finally, we reload the Postfix service to apply changes:

# service postfix restart

[Stuck with the process? We’d be happy to assist you]

 

Conclusion

In short, we saw how our Support Techs configure Postfix on the Plesk server on Google Cloud.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF