我保证这不仅仅是另一个 Mail::queue 新手问题。我有使用 Iron.io 推送队列的 Laravel 4.2 应用程序然后,我升级到 Laravel 5.1,我的邮件刚刚停止工作。我有 UserController,我从它向注册人发送用户帐户验证电子邮件。
//Used for Mail
$data=['msg'=>$msg];
$details=array(
'email'=>$email,
'name'=>$name,
'subject'=>$subject,
'msg'=>$msg);
\Mail::queue(['text'=>'emails.contactus'],$data,
function($message) use ($email,$name,$subject) {
$message->from($email,$name);
$message->to(Config::get('app.site_support'))->subject($subject);
});
Iron.io 已正确配置密钥等。我的邮件队列应用程序和队列处理应用程序是不同的。
我得到的错误是
[2015-10-19 18:12:32] production.INFO: Queue POST Item received
[2015-10-19 18:12:32] production.ERROR: exception 'ErrorException' with message 'Class 'UserController' not found' in /var/www/app/vendor/jeremeamia/SuperClosure/src/SerializableClosure.php:130
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Class 'UserCont...', '/var/www/app...', 130, Array)
#1 /var/www/app/vendor/jeremeamia/SuperClosure/src/SerializableClosure.php(130): Closure->bindTo(NULL, 'UserController')
#2 [internal function]: SuperClosure\SerializableClosure->unserialize('a:5:{s:4:"code"...')
#3 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(300): unserialize('C:32:"SuperClos...')
#4 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(286): Illuminate\Mail\Mailer->getQueuedCallable(Array)
看起来 Mail::queue 正在序列化队列/接收处理器应用程序中不可用的 UserControl。我尝试将 UserController 放在处理器应用程序中,但仍然出现相同的错误