0

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','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);
}
  • That class no longer exists in Laravel 8. You can probably do all of this with the current built-in Mail functions. – aynber Aug 13 '21 at 12:59

1 Answers1

0

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.