laravel / framework

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

[5.4] Interacts with Queue on Mail #18065

Closed stefensuhat closed 7 years ago

stefensuhat commented 7 years ago

Description:

Cannot Interacts with Queue on Mail for example: tries , timeout like on Jobs

Steps To Reproduce:

on my Mail\PasswordReset.php:

    class PasswordReset extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels, InteractsWithQueue;

    public $tries = 1;

    public $email, $token;

    /**
     * Create a new message instance.
     *
     * @param $email
     * @param $token
     */
    public function __construct($email, $token)
    {
        $this->email = $email;
        $this->token = $token;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('front.emails.auth.password-reset');
    }
}
themsaid commented 7 years ago

Cannot

Please share more details, what's not working?

stefensuhat commented 7 years ago

@themsaid public $tries = 1; function is not working. I still need to command art queue:work --tries=1.

tomcoonen commented 7 years ago

I seem to have a similiar issue, I implemented ShouldQueue but setting the queue in the constructor doesn't have any effect. The mail isn't even queued, but sent directly. https://laravel.com/docs/5.4/mail#queueing-mail

class OrderConfirmation extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct()
    {
        $this->queue = 'email';
    }
tomcoonen commented 7 years ago

@themsaid I got an email notification but don't see your post here, I added some extra info to my original comment.

themsaid commented 7 years ago

@tomcoonen I think this is something else, I just tested your scenario and it works fine please double check your email queue.

themsaid commented 7 years ago

@ssuhat opened a PR to add this feature: https://github.com/laravel/framework/pull/18103

Thanks

tomcoonen commented 7 years ago

@themsaid found it: https://github.com/laravel/framework/issues/18147