code: public function sendException(Request $request, \Exception $exception)
      {
          if (!$this->enabled) {
              return;
          }
  
          $serverParams = $request->server->all();
          if (isset($serverParams['PHP_AUTH_PW'])) {
              $serverParams['PHP_AUTH_PW'] = '*****';
          }
  
          $message = \Swift_Message::newInstance()
              ->setSubject('Error message from '.$request->getHost().' - '.$exception->getMessage())
              ->setFrom($this->from)
              ->setTo($this->to)
              ->setContentType('text/html')
              ->setBody(
                  $this->templating->render(
                      "SoclozMonitoringBundle:Notify:exception.html.twig", array(
                          'request' => $request,
                          'exception' => $exception,
                          'exception_class' => \get_class($exception),
                          'request_headers' => $request->server->getHeaders(),
                          'request_attributes' => $this->mailerTransformer->transform($request->attributes->all()),
                          'server_params' => $this->mailerTransformer->transform($serverParams),
                      )
                  )
              );
  
          try {
              $this->getMailer()->send($message);
          } catch (\Exception $e) {
              $this->logger->error('Sending mail error - '.$e->getMessage());
          }
      }
docs: Send error notify mail
  
  @param Request    $request
  @param \Exception $exception