lundi 12 février 2018

Why Lumen don't want to send Mailable messages?

I'am working with Laravel Lumen and can't send Mailable messages.

Mailable class is very simple

<?php

namespace App\Mail;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class OrderNote extends Mailable
{
    use SerializesModels;

    public function __construct() {}

    public function build()
    {
        return $this->from('info@domain.com')
            ->subject('New note')
            ->view('email.test');
    }
}

In controller only

...
Mail::to('receiver@gmail.com')
    ->send(new OrderNote());
...

But nothing happened, when controller method execute. Why Mailable don't work?

PS. When I'am replace code in controller to

Mail::send('email.test', [], function ($message) {

    $message->from('info@domain.com');
    $message->to('receiver@gmail.com', 'John Smith')->subject('Welcome!');
});

it is works fine.

Thanks in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire