Register at SendinBlue.com and Use His SMTP in Laravel
Tags: laravel, sendinblue, smtp
Published: 2021-08-10 10:58:36

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](https://app.sendinblue.com/account/register) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/emw1b45ki6i28zy88u0o.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5o0137kje0ykaurbjek.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sy6aqrz1eecgyqkkkmmi.png)
![Create SMTP Key Name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5986skbd0zqts0tkawuq.png)

Then click the **GENERATE** button to create. If successful, it will produce a display like the following.
![Sendinblue SMTP Credentials](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r34z8c4wdltb0fsephnf.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdgx7895r3u28vondj14.PNG)

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}"
```

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](https://jurnalmms.web.id/pemrograman/cara-daftar-dan-setting-smtp-sendinblue-di-laravel/) article