laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.2k stars 10.89k forks source link

Mail::send callback ignored for mailables #19066

Closed tpetry closed 7 years ago

tpetry commented 7 years ago

Description:

The callback of Mail::send($view, array $data = [], $callback = null) is ignored when sending a Mailable because the callback is not passed to sendMailable function and back to the mailer:

    public function send($view, array $data = [], $callback = null)
    {
        if ($view instanceof MailableContract) {
            return $this->sendMailable($view);
        }

        // ...
    }

For a mailable which is not queued the callback should be called.

Steps To Reproduce:

Mail::send(new SomeMailable(), [], function() {
    var_dump('callback called');
});
themsaid commented 7 years ago

It wasn't supposed to be used like this in the original implementation, but feel free to open a PR with your suggestion.

Or for suggestions and feature requests please use the https://github.com/laravel/internals repo.