How to configure mail.php and service.php in laravel 9 project when i use Sendinblue smtp service

177 Views Asked by At

In development it works perfectly, the emails reach the recipient, but when I display the project in cpanel I get a 500 error when my client presses the send button.

Currently my configuration is like this:

.ENV:

MAIL_MAILER=smtp
MAIL_HOST=smtp-relay.sendinblue.com
MAIL_PORT=587
MAIL_USERNAME=myEmailUserSendinblue
MAIL_PASSWORD=passwordMySendiblueService
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="EmailClient"
MAIL_FROM_NAME="${APP_NAME}"
SENDINBLUE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxx

mail.php:

'mailers' => [
        'sendinblue' => [
            'transport' => 'sendinblue',
            'host' => env('MAIL_HOST', 'smtp-relay.sendinblue.com'),
            'port' => env('MAIL_PORT', 587),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            
        ],

services.php:

return [
    'sendinblue' => [
    'api_key' => env('SENDINBLUE_API_KEY'),
    ],
    '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'),
    ],

];

Thank you very much in advance, I remain attentive to your comments.

EDIT 1: I got an error through the laravel logs, it is as follows: production.ERROR: Unsupported mail transport [sendinblue]. {"exception":"[object] (InvalidArgumentException(code: 0): Unsupported mail transport [sendinblue]. at /home/-------/public_html/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php:157) [stacktrace]

0

There are 0 best solutions below