Sending transactional emails with a third-party service on Symfony

Photo by Brett Jordan on Unsplash

Objectives

Choosing a service provider

Prerequisites

Click above to create an account

Content

  • Configure sending with Sendinblue
  • Anticipate an unavailability of the sending service
  • Receive the deliverability status of the emails sent (8 steps)

Configure sending with Sendinblue

Connector installation with Composer
Setting up the Sendinblue connector

Anticipate an unavailability of the sending service

Setting up a backup solution

Receive the deliverability status of the emails sent

1/ Create a Doctrine entity

The Message entity

2/ Get a unique identifier for each email sent

Retrieve the unique identifier of each e-mail

3/ Create a controller to receive webhook calls from Sendinblue

Controller to get notified of the sent email

4/ Setting up a ParamConverter

Hide this JSON that I don’t want to see!

5/ Restrict access to the route dedicated to the webhook

Securing access to the webhook controller

6/ Testing the webhook locally

Emulate a Sendinblue notification with the Javascript console

7/ Activate the webhook on the Sendinblue platform

Weebhook activation

8/ Bonus: translation file of the status of emails

Translations of the different events

The final word

References

Thanks

--

--

--

Développeur PHP Symfony indépendant

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fabien Lemoine

Fabien Lemoine

Développeur PHP Symfony indépendant

More from Medium

Laradock with different php versions between projects

Real-Time Private Chat Application using PHP Ratchet Websockets

PHP 7.4 vs PHP 8.1 Magento 2 an Adobe Commerce Performance

A simple PHP site (4/?)— Routing