Reputation: 10064
Getting this error when trying to send a simple email:
Class setQueue does not exist at vendor/laravel/framework/src/Illuminate/Container/Container.php:779)
Here is the code causing it:
Mail::raw($data['email_body'], function (Message $message) use ($email_or_url, $data) {
$message->to($email_or_url);
$message->subject($data['email_subject']);
});
Why would Laravel be trying to queue this and how do I make it stop?
Upvotes: 0
Views: 1828
Reputation: 3686
My solution was to valet install
again as I got the error after running brew update/upgrade
related details:
PHP 7.3.0 (cli) (built: Dec 7 2018 11:00:11) ( NTS )
Upvotes: 0
Reputation: 1050
What I've found by now in my research for the solution is that in my case it is not about the php version (I even reinstalled everything and changed my servers providers because of the laracasts answers) but it was a code caused error, and I know because i reverted to previous commit and it worked fine.
In my case it was because I had a transaction before the email sending
$suma = $user->transactionsAsUser->filter(
function ($transaction) {
return $transaction->status == 'successful' || $transaction->kanjea_ammount < 0;
}
)->sum('kanjea_ammount');
$user->kanjea_balance = $suma;
$user->save();
\Mail::to($user->email)->send(new \App\Mail\JustRegistered($user));
When I removed that fragment before the last line, it just worked fine. Even using PHP 7.3.
By the way. this problem doesn't occur in my local environment w7+xampp, but only dokku
Upvotes: 0
Reputation: 93
I am also facing the same issue in MacBook Pro. For MacBook Users just use command
"valet restart"
In my case, it's working now. Try to restart your server that might be helpful.
Note: I am using PHP 7.3.*
Upvotes: 1
Reputation: 37
bug case in laravel project for this issue. https://github.com/laravel/framework/issues/26819
It turned out to be a problem in php. Laravel has patched it so you have 2 options to fix. Use the patch version and hope there aren't other places php 7.3 breaks laravel, or downgrade your project to 7.2
Upvotes: 1
Reputation: 21
it happens to me because i was running php 7.3, when i downgrade to php 7.2.13 it works, and i also change the QUEUE_DRIVER variable in .env and config/queue.php
Upvotes: 0
Reputation: 5552
Make sure you rename your QUEUE_DRIVER
environment variable to QUEUE_CONNECTION
in both config/queue.php
and .env
- it was renamed in 5.7
https://laracasts.com/discuss/channels/laravel/trying-to-send-email-class-setqueue-does-not-exist
Why would Laravel be trying to queue this and how do I make it stop?
It's not trying to queue this email, but MailServiceProvider
still registers a queue driver (for when an email implements the ShouldQueue
interface).
Upvotes: 0