Skip to content
This repository was archived by the owner on Apr 5, 2023. It is now read-only.

agence-webup/laravel-sendinblue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-sendinblue

Laravel's mail transport for SendinBlue

Build Status

Installation of version 2.x

composer require webup/laravel-sendinblue:^2

Compatibility

Version Laravel Sendiblue Api
2.* 5.5 and above v3
1.1.* 5.5 and above v2
1.0.* 5.0 - 5.4 v2

Provider

config/app.php

    'providers' => [
        Webup\LaravelSendinBlue\SendinBlueServiceProvider::class,
    ],

Configuration

config/services.php

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

.env

MAIL_DRIVER=sendinblue
SENDINBLUE_KEY=your-access-key

Usage in Mailable with Template Id

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

  • 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.

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

    use SendinBlue;

    // ...

    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:

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

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

Note: Do not use hyphens '-' in the variable names. {{ params.FIRST_NAME }} will work properly, but {{ params.FIRST-NAME }} will fail. Source: sendinblue/APIv3-php-library#151

About

DEPRECATED: Laravel's mail transport for SendinBlue

Resources

License

Stars

Watchers

Forks

Contributors 12

Languages