当我将 Laravel 5.8 升级到 8 时在 handler.php 中给出错误,而我是 composer update 调用未定义的函数 Illuminate\Mail\TransportManager() 如何解决这些请帮助..
public function report(Throwable $exception) {
Config::set('mail.driver', 'smtp');
Config::set('mail.port', 587);
Config::set('mail.host', 'mail.ccc.com');
Config::set('mail.username','test@gmail.com');
Config::set('mail.password','UKK(a^}#~Fr[');
Config::set('mail.from.address','error-reporting@gmail.com');
Config::set('mail.from.name','test');
Config::set('mail.encryption','tls');
$app = \App::getInstance();
$app->singleton('swift.transport', function ($app) {
return \Illuminate\Mail\TransportManager($app);
});
$mailer = new \Swift_Mailer($app['swift.transport']->driver());
\Mail::setSwiftMailer($mailer);
if (!$exception instanceof TokenMismatchException) {
if (!$this->isHttpException($exception)) {
if ($exception->getMessage() != 'Unauthenticated.') {
$handler = new SymfonyExceptionHandler();
$exceptionHtml = $handler->getHtml($exception);
$subject = 'Error Reporting : ' . $exception->getMessage();
$cc = 'testmail@gmail.com';
$to = 'testmail@gmail.com';
$data = array('msg'=>$exceptionHtml);
$ss = \Mail::send('email.error-reporting-message', $data, function ($message) use ($to,$cc,$subject)
{
$message->to($to, 'Test')
->cc($cc, 'Test')
->subject($subject);
});
}
}
}
parent::report($exception);
}