When i upgrade Laravel 5.8 to 8 given error in handler.php while i am composer update Call to undefined function Illuminate\Mail\TransportManager() How to resolve these please Help..
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','[email protected]');
Config::set('mail.password','UKK(a^}#~Fr[');
Config::set('mail.from.address','[email protected]');
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 = '[email protected]';
$to = '[email protected]';
$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);
}
Your app is referencing an old class that hasn't existed since Laravel 6. You should look at simplifying this to just use
Mail. This should do everything you need. The majority of it you already have anyway.