Setting up your SMTP Server with Mailjet
A guide to set up your Mailjet SMTP server in django

Search for a command to run...
A guide to set up your Mailjet SMTP server in django

No comments yet. Be the first to comment.
Adding a few cities to a delivery zone is instant. Adding 5,000 cities ran over 5,000 database round-trips and regularly timed out the request. The root causes were two common Django patterns that don

Every day, a report runs: "what did each store sell yesterday?" One of the stores is in Lagos, the other in London. The report showed both stores as having zero sales for the last two hours of the day

You don't always control the schema you work with. Sometimes you inherit a codebase where GenericForeignKey is threaded through the models, and a migration isn't on the table. Loading a page of 20 aud

Your users want live updates: an order flips to paid, a notification pops, a dashboard number ticks up without a refresh. The obvious answer in Django is Channels. I reached for it first too. But as o

Change a product's price anywhere in your app, and it instantly syncs to a third-party marketplace. No manual triggers, no polling, no fragile save() overrides. Here's the signal pattern that powers i

Hello there 👋. In this article, I'll be walking you through on
Though this article is gonna be focusing on Django as the backend, the same process should apply to whatever backend framework you wish to use. You'll just have to check if there's a package for mailjet that works with your framework
NB: You'll need to have knowledge of Django or whatever backend framework you use. We are simply replacing the default SMTP server provided in django with a better option. And yes, it's free! 😙
Click on this link and let's get started. That should lead you to the page below. Enter your email address and password, then click on sign up.

That takes up to the page below. If you are currently unemployed or a student, you can fill in Organization name with your name, Organization URL with a link to your portfolio or blog. Then select Other under Main industry

You don't need to add a payment method. Click on Complete order

You should get an email from mailjet to activate your account

After activating it, you'll be led to this page. Click on getting started as a developer

What we need is a SMTP server so click on SMTP relay and continue

And here it is folks. We have our SMTP server set up and begging to be used!

If we just use the keys provided by Mailjet in our app, we'll run into errors. And that's where django-mailjet comes to the rescue. This package helps us configure our email backend to work seamlessly with Mailjet.
Install the package using
pip install django-mailjet
Now, the final step. In your settings.py file, add the following settings.
EMAIL_BACKEND = 'django_mailjet.backends.MailjetBackend'
EMAIL_HOST = 'in-v3.mailjet.com'
MAILJET_API_KEY = "your mailjet api key here"
MAILJET_API_SECRET = "your mailjet secret key here"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_TIMEOUT = 30
DEFAULT_FROM_EMAIL = 'sender_name <email_name>'
Where sender_name is a custom sender name and email_name is an email address you want the emails to be sent from. Note that email_name must be registered on your mailjet account.
And we're done! Don't forget to store your API_KEY and API_SECRET with environment variables
Thanks for reading to the end. A like would be appreciated 😊
¡Hasta luego!