laravel-mailjet icon indicating copy to clipboard operation
laravel-mailjet copied to clipboard

Driver [mailjet] not supported

Open gcjbr opened this issue 1 year ago • 0 comments

I'm trying to use Mailjet as a Laravel driver, meaning I'm trying to avoid invoking it's classes directly.

I did my best to follow the documentation, which is a bit ambivalent on this use, this is what I did:

My .env

MAIL_DRIVER=mailjet
MAILJET_APIKEY=MYKEY
MAILJET_APISECRET=MYSECRET
MAIL_FROM_ADDRESS=MYMAIL
MAIL_FROM_NAME=MYNAME

My services.php return array:


...

    'mailjet' => [
        'key' => env('MAILJET_APIKEY'),
        'secret' => env('MAILJET_APISECRET'),
        'transport' => 'mailjet',   // I tried both with and without this

    ],

...

Added Mailjet\LaravelMailjet\MailjetServiceProvider::class, to my providers array and 'Mailjet' => Mailjet\LaravelMailjet\Facades\Mailjet::class to my aliases.

And here's the class which is triggering the error:


<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class meuResetDeSenha extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($token)
    {
        $this->token = $token;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     */
    public function via($notifiable): array
    {
        return ['mailjet'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     */
    public function toMail($notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject('Redefina sua senha ')
            ->greeting('Olá!')
            ->line('Você está recebendo este e-mail porque nós recebemos uma requisição para sua conta.')
            ->action('REDEFINIR SENHA', route('password.reset', $this->token))
            ->line('Se você não requisitou uma redefinição de senha, nenhuma ação é necessária.')
            ->markdown('vendor.notifications.email');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     */
    public function toArray($notifiable): array
    {
        return [
            //
        ];
    }
}


I can't use the solution here https://github.com/mailjet/laravel-mailjet/issues/58 since MailjetMailServiceProvider::class no longer exists.

gcjbr avatar Apr 17 '24 18:04 gcjbr