Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Unable to queue Mailable if using priority #40922

Closed
giggsey opened this issue Feb 10, 2022 · 2 comments
Closed

[9.x] Unable to queue Mailable if using priority #40922

giggsey opened this issue Feb 10, 2022 · 2 comments

Comments

@giggsey
Copy link
Contributor

giggsey commented Feb 10, 2022

  • Laravel Version: 9.0.1 (I think I saw this in 8.x too, but didn't investigate)
  • PHP Version: 8.0.14

Description:

If your Mailable has a priority (assuming the bug in #40916 has been fixed), then the message will fail to queue with:

Serialization of 'Closure' is not allowed

This is because the priority setting is done through a callback within Mailable.

Steps To Reproduce:

class MyTestEmail extends Mailable implements ShouldQueue {
    public function __construct() {
        $this->priority(1);
    }
}

\Mail::to('[email protected]')->queue(new MyTestEmail());
@giggsey
Copy link
Contributor Author

giggsey commented Feb 10, 2022

Moving priority() into the build function instead of the constructor works enough as a workaround, so maybe that's fine.

@driesvints
Copy link
Member

Yes please move this to the build method. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants