Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Postfix on Plesk server on Google Cloud using SendGrid

by | Jun 16, 2021

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/ configuration file and open it in a text editor:
    # cp -a /etc/postfix/{,.original}
    # vi /etc/postfix/
  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 = []: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/ | grep 

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

Then we generate the SASL password map:

# echo []: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]



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


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.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

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



Privacy Preference Center


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]


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


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

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie


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.