DEV Community

Cover image for Register at SendinBlue.com and Use His SMTP in Laravel
Martin Mulyo Syahidin
Martin Mulyo Syahidin

Posted on

Register at SendinBlue.com and Use His SMTP in Laravel

Sendinblue is an email marketing service aimed at mid-level bussiness. Sendinblue has automation features, integrated customer management, and email template creation services. The price offered by Sendinblue is also attractive and will not drain the pocket.

Oops.. But we will not use all the capabilities of Sendinblue and pay for the service, we will only use Sendinblue as an email delivery service for our application utilizing their SMTP server, and of course it's free.

I've tried various SMTP services, such as Sendgrid, Mailchimp, Mailjet and Sendinblue. And among the four services, I decided Sendgrid was the best, and was followed by Sendinblue. However, Sendgrid is a bit complicated and Sendinblue is simpler. And the most important thing is the price. In the free version, Sendgrid provides a free sending quota of 100 emails, while Sendinblue reaches 300. That's the difference that made me decide to use Sendinblue.

As an email delivery service that provides an SMTP server and API key, Sendinblue can be used in various projects, languages and frameworks. And in this post, we will configure Sendinblue SMTP for use in Laravel applications.

Register at Sendinblue.com

Before using the sendinblue service, we must register first. Please open the sendinblue.com website and register using your email and password. Then verify the registered email by clicking the verification link sent to the registered email. Registration is very easy and less than 5 minutes.
Register at Sendinblue.com

After registering, we have to get the given SMTP credentials.

Getting Sendinblue SMTP Credentials

After successfully registering and verifying your email, you will be directed to the Sendinblue dashboard page. In this dashboard, we can make settings for advertising campaigns, manage contacts, and others. But, if we want to use it as an email sender, we only need to get the API key or SMTP credentials.

On the dashboard page, click the dropdown on the top right and select “SMTP & API” to view the SMTP credentials and API key.
Dropdown Link to Create SMTP Key

Next, click the “CREATE A NEW SMTP KEY” button on the right. Next, in the pop-up fill in the name of the SMTP that will be created.
Create SMTP Key Button
Create SMTP Key Name

Then click the GENERATE button to create. If successful, it will produce a display like the following.
Sendinblue SMTP Credentials

In this section, note the SMTP server address, port, login (email) and master password. This data will then be used in our application.

Sendinblue SMTP settings in Laravel

Next, please open the .env file in your Laravel project. On the 31st line in the mailer section, fill in the data as follows.
Mailer setting in Laravel environment

In the MAIL_USERNAME section, fill in the Sendinblue SMTP username (email), in the MAIL_PASSWORD section, fill in the Sendinblue SMTP password that was previously recorded. Also adjust the MAIL_HOST and MAIL_PORT.

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.sendinblue.com
MAIL_PORT=587
MAIL_USERNAME=username@sendiblue.email
MAIL_PASSWORD=PASSWORD-SMTP
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="no-reply@domainsaya.com"
MAIL_FROM_NAME="${APP_NAME}"
Enter fullscreen mode Exit fullscreen mode

In the MAIL_FROM_ADDRESS section, you can fill in a free email, whether it is a valid email or not. This email will be used as the sender's identity.

It's finished. At this point, everything should be ready. We can already send emails using the Sendinblue service in Laravel.

Thank you and good bye!

Translated from Indonesian from the MMS Journal Blog article

Top comments (0)