2017 © Pedro Peláez
 

library laravel-sendinblue

Laravel's mail transport for SendinBlue

image

webup/laravel-sendinblue

Laravel's mail transport for SendinBlue

  • Wednesday, July 18, 2018
  • by agencewebup
  • Repository
  • 9 Watchers
  • 21 Stars
  • 31,925 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 2 Open issues
  • 5 Versions
  • 39 % Grown

The README.md

DEPRECATED

maintenance-status No Maintenance Intended, (*1)

As of April 2023 this repo is deprecated and unmaintained., (*2)

Since Laravel 9, there is official support for Sendinblue as a regular mail transport thanks to symfony/sendinblue-mailer. It supports SiB through API and SMTP, with templates, tags, and custom headers. Because Laravel 8 has reached its end of life, the official support has now become the new default., (*3)

You can find more about how to use it inside your Laravel project in the Laravel documentation., (*4)

For any need beyond beyond that, use Sendinblue's official PHP SDK., (*5)

Feel free to fork this repository if you need to modify it for legacy reasons., (*6)

Special thanks to the wonderful contributors that kept this project standing over the years 🙏. You rock 🤘, (*7)

Summary

Installation

composer require webup/laravel-sendinblue

Compatibility, (*8)

Version Laravel Sendinblue Api
3.* 7.0 and above v3
2.* 5.5 - 6.* v3
1.1.* 5.5 - 6.* v2
1.0.* 5.0 - 5.4 v2

Configuration

config/mail.php, (*9)

    'mailers' => [
        // ...
        'sendinblue' => [
            'transport' => 'sendinblue',
        ],
    ]

config/services.php, (*10)

    'sendinblue' => [
        // api-key or partner-key
        'key_identifier' => env('SENDINBLUE_KEY_IDENTIFIER', 'api-key'),
        'key' => env('SENDINBLUE_KEY'),
    ],

.env, (*11)

MAIL_MAILER=sendinblue
SENDINBLUE_KEY=your-access-key

# if you need to set the guzzle proxy config
# those are example values
HTTP_PROXY="tcp://localhost:8125"
HTTPS_PROXY="tcp://localhost:9124"
NO_PROXY=.mit.edu,foo.com

Usage in Mailable with Template Id

Using the sendinblue() method you may pass extra fields listed below. All fields are optional:, (*12)

  • template_id (integer)
  • tags (array)
  • params (array)

If you want to use the subject defined in the template, it's necessary to pass the SendinBlueTransport::USE_TEMPLATE_SUBJECT placeholder in the subject(). You may as well override the subject text here. Otherwise, without the subject() method, the subject will be derived from the class name., (*13)

Mailable requires a view - pass an empty array in the view() method., (*14)

<?php

declare(strict_types=1);

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Webup\LaravelSendinBlue\SendinBlue; // <- you need this
use Webup\LaravelSendinBlue\SendinBlueTransport; // <- you need this

class MyMailable extends Mailable
{
    use Queueable;
    use SerializesModels;
    use SendinBlue; // <- you need this

    // ...

    public function build()
    {
        return $this
            ->view([])
            ->subject(SendinBlueTransport::USE_TEMPLATE_SUBJECT) // use template subject
            // ->subject('My own subject') // subject overridden
            ->sendinblue(
                [
                    'template_id' => 84,
                    'tags'        => ['offer'],
                    'params'      => [
                        'FIRSTNAME' => 'John',
                        'LINK'      => 'https://www.example.com',
                        'AMOUNT'    => '29',
                    ],
                ]
            );
    }
}

Params are accessbile in the SendinBlue template as:, (*15)

  • {{ params.FIRSTNAME }}
  • {{ params.LINK }}
  • {{ params.AMOUNT }}

You may as well use param substitution in the subject field, eg.:
{{ params.FIRSTNAME }}, forgot your password?!, (*16)

Note: Do not use hyphens '-' in the variable names. {{ params.FIRST_NAME }} will work properly, but {{ params.FIRST-NAME }} will fail. Source: https://github.com/sendinblue/APIv3-php-library/issues/151, (*17)

Regarding additional features

This library aims to provide a Laravel-compatible interface for SendInBlue along with support for template ids, tags and params., (*18)

If you need features like specific SendInBlue beta SMTP Template batching, you should directly use the official SendInBlue PHP library., (*19)

The Versions

18/07 2018

dev-master

9999999-dev

Laravel's mail transport for SendinBlue

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen laravel5 mailing sendinblue stmp

18/07 2018

v1.1.2

1.1.2.0

Laravel's mail transport for SendinBlue

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen laravel5 mailing sendinblue stmp

12/02 2018

v1.1.1

1.1.1.0

Laravel's mail transport for SendinBlue

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen laravel5 mailing sendinblue stmp

03/09 2017

v1.1.0

1.1.0.0

Laravel's mail transport for SendinBlue

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen laravel5 mailing sendinblue stmp

21/04 2016

v1.0.0

1.0.0.0

Laravel's mail transport for SendinBlue

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen laravel5 mailing sendinblue stmp