Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

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

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

Configure Mailjet in Google Cloud – How to do

by | Jul 4, 2021

Wondering how to Configure Mailjet in Google Cloud?  We can help you.

Here at Bobcares, we often handle requests from our customers to configure Mailjet on their GCP as a part of our Server Management Services.

Today we will see how our Support Engineers do this for our customers.

How to configure Mailjet in Google Cloud

Now we will see the steps that our Support Engineers follow for this setup.

Prerequisites for configuring Mailjet

Following are the prerequisites for this setup:

1. Firstly, we need to create a new Mailjet account.

2. Then get Mailjet SMTP account credentials.

3. After that we must ensure the email address we wish to send emails from has been validated.

4. Also we have to set up a firewall rule to allow TCP traffic on port 2525.

Configuring Mailjet as an SMTP relay Using Postfix

Following are the steps to configure Mailjet:

  1. Firstly, connect to your VM using SSH using the following command:
    gcloud compute ssh instance-name
  2. Then we must install the Postfix Mail Transport Agent on the VM using the following command:
    sudo apt update && sudo apt -y install postfix libsasl2-modules
  3. After that, we will modify the Postfix configuration options by opening the main.cf file:
    sudo vi /etc/postfix/main.cf
  4. Now we can update the file as given below:
    1. We need to comment out the following lines:
      # default_transport = error 
      # relay_transport = error
    2. And add the following lines to the end of the file:
      relayhost = in-v3.mailjet.com:2525
      smtp_tls_security_level = encrypt 
      smtp_sasl_auth_enable = yes 
      smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd 
      smtp_sasl_security_options = noanonymous

      Note: We must use port 2525 here since port 25 is not allowed on Compute Engine.

    3. After making the changes we can save the changes and close the file.
  5. Now, we will create the SASL password map:
    sudo vi /etc/postfix/sasl_passwd
  6. To the sasl_passwd file, we must add the following lines to provide the credentials for Mailjet:
    in-v3.mailjet.com:2525 YOUR_API_KEY:YOUR_SECRET_KEY
  7. Next, we will use the postmap utility to generate a .db file:
    sudo postmap /etc/postfix/sasl_passwd 
    sudo ls -l /etc/postfix/sasl_passwd*
    -rw------- 1 root root    68 Jun  1 10:50 /etc/postfix/sasl_passwd 
    -rw------- 1 root root 12288 Jun  1 10:51 /etc/postfix/sasl_passwd.db
  8. And remove the file that contains the credentials since it is no longer needed:
    sudo rm /etc/postfix/sasl_passwd
  9. Then we will set the following permissions on our .db file:
    sudo chmod 600 /etc/postfix/sasl_passwd.db 
    sudo ls -la /etc/postfix/sasl_passwd.db
    
  10. Finally, we can reload the configuration using the following:
    sudo /etc/init.d/postfix restart
  11. We can install the mailx or mailutils package and test our configuration.
    sudo apt -y install mailutils
  12. To send a test message we can use the following:
    echo 'Test passed.' | mail -s 'Test-Email' -aFrom:from-email destination-email

    We can also check our system’s logs for a status line containing status and the successful server response code (250):

    sudo tail -n 5 /var/log/syslog

[Need assistance? We can help you]

Conclusion

To conclude, we saw the steps that our Support Techs follow to Configure Mailjet in Google Cloud for our customers.

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 *

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

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

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

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