Integrate Sendinblue in Laravel 9

Viewed 32

I'm trying to integrate the Sendinblue API in my Laravel 9 Project. Therefore I'm following the docs from https://laravel.com/docs/9.x/mail#custom-transports

I'v installed the "symfony/sendinblue-mailer" package" an edited the services.php file which now looks like:

<?php

return [
'mailgun' => [
    'domain' => env('MAILGUN_DOMAIN'),
    'secret' => env('MAILGUN_SECRET'),
    'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
    'scheme' => 'https',
],

'postmark' => [
    'token' => env('POSTMARK_TOKEN'),
],

'ses' => [
    'key' => env('AWS_ACCESS_KEY_ID'),
    'secret' => env('AWS_SECRET_ACCESS_KEY'),
    'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'sendinblue' => [
    'key' => 'My-code-is-here',
],

];

Moreover I have modified the AppServiceProvider.php by the following code from the docs, so that the file contains now:

<?php
 namespace App\Providers;
 use Illuminate\Support\ServiceProvider;
 use Illuminate\Support\Facades\Mail;
 use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
 use Symfony\Component\Mailer\Transport\Dsn;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
    //
}
public function boot()
{
    Mail::extend('sendinblue', function () {
        return (new SendinblueTransportFactory)->create(
            new Dsn(
                'sendinblue+api',
                'default',
                config('services.sendinblue.key')
            )
        );
    });
}

}

When I try to send an email, I get the following error: InvalidArgumentException: Mailer [sendinblue] is not defined. in file \vendor\laravel\framework\src\Illuminate\Mail\MailManager.php on line 110

How can I solve that problem? Thanks!

0 Answers
Related