Swapping Sendgrid for Mailjet in 10 Minutes


Image credit to Alvaro Montoro.
I run my backend on GCP Cloud Run. For low-volume transactional email, like signup confirmations or report delivery, I had been happily using Sendgrid. GCP even offers a one-click integration with Sendgrid, which used to include a free tier. It was simple, reliable, and cost exactly $0. Perfect.
Everything was copasetic.
For a week.
Then, I learned (the hard way) that Sendgrid quietly deprecated that free tier. It's still advertised on GCP's docs, but it no longer exists. Their cheapest plan? $15/month. Which is a bit silly for sending maybe a few dozen emails a month.
So I swapped Sendgrid out with another authoritative provider in about 10 minutes' time.
Step 1: Choose a New SMTP Provider
There are plenty of SMTP relay services out there. I looked at:
Maileroo
SMTP2Go
Mailjet
Maileroo and SMTP2Go both came highly recommended. But one of them—frustratingly—couldn’t even get a confirmation email through to me during signup. That’s not what you want from a company whose entire job is to send email. I moved on.
Mailjet worked great. Free tier. Quick onboarding. DNS setup instructions that didn’t make me want to scream. I was sold. (No, Mailjet isn't paying for this post either.)
Step 2: Update Your DNS (SPF & DKIM)
Since spam is so pervasive we have security standards to authenticate the sender. For this we have SPF and DKIM.
I use Cloudflare for DNS and cannot recommend it enough. They make everything easy, and they never go down. (No, they're not sponsoring this post—but they should.) Seriously, Cloudflare FTW. Or Slay. Or Skibidi. Or, whatever the kids are saying nowadays for superlative execution.
Here’s what the DNS records looked like:
DKIM: Mailjet gives you a DKIM record to add—a TXT entry that looks something like:
mailjet._domainkey.yourdomain.com TXT "k=rsa; p=..."
Drop it in. Click Save. Done.
SPF: If you already have an SPF record, you’ll need to merge Mailjet’s "include:" directive into the existing record. Mine went from:
"v=spf1 include:_spf.mx.cloudflare.net ~all"
to:
"v=spf1 include:spf.mailjet.com include:_spf.mx.cloudflare.net ~all"
Just insert the "include:spf.mailjet.com". Do not try to add two SPF records, you should only have one.
Step 3: Update Environment Variables
I use the excellent FastAPI Full Stack template for this project. Emails are sent via SMTP and configured through the .env file.
Previous Sendgrid Config:
SMTP_HOST=smtp.sendgrid.net
SMTP_USER=apikey
SMTP_PASSWORD=your-sendgrid-api-key
EMAILS_FROM_EMAIL=my-sender@host.com
SMTP_TLS=True
SMTP_SSL=False
SMTP_PORT=587
Updated Mailjet Config:
SMTP_HOST=in-v3.mailjet.com
SMTP_USER=my-mailjet-api-key
SMTP_PASSWORD=my-mailjet-secret
EMAILS_FROM_EMAIL=my-sender@host.com
SMTP_TLS=True
SMTP_SSL=False
SMTP_PORT=587
No code changes. Just updated the env vars, redeployed to Cloud Run, and done.
Updating env variables can be done via the gcloud CLI or the GCP console. If you have a GCP Cloud Run Service click: Services > The Service to Update > Edit & deploy a new revision > Variables & Secrets > ... and update those values. It's the same for the GCP Cloud Run Jobs, but instead of Services click Jobs.
Back in business.
This is how easy swapping out service providers should be. I love it.
Step 4: Test
I re-ran a signup flow and confirmed the email went through. Mailjet’s dashboard showed the event logs and status, which gave me confidence everything was properly authenticated and delivered.
Mailjet FTW
Final Thoughts
Swapping SMTP providers took less than an 15 minutes—most of it figuring our which provider I'd switch to. Mailjet’s free tier is plenty for my current needs, and the switch was painless. If my service takes off, I'll easily switch into their paid tier.
It’s also a reminder that dependencies—especially the “free” ones—can change out from under you. Know your stack. And have an escape hatch.
Need help building systems that scale (and recover gracefully when vendors change the rules)? That’s what I do at Heavy Chain Engineering, designing resilient, high-performance systems that stay flexible under real-world conditions.
If you're building something serious, let’s talk: heavychain.org
Subscribe to my newsletter
Read articles from Jason Vertrees directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
