user = $user; $this->destination = $destination; $this->ip = $ip; $this->exception = $exceptionData; Log::debug('In mail job constructor'); } /** * Execute the job. * * @return void */ public function handle() { Log::debug('Start of handle()'); if ($this->attempts() < 3) { // mail? try { $email = env('SITE_OWNER'); $args = [ 'class' => $this->exception['class'], 'errorMessage' => $this->exception['errorMessage'], 'stacktrace' => $this->exception['stackTrace'], 'file' => $this->exception['file'], 'line' => $this->exception['line'], 'code' => $this->exception['code'], 'loggedIn' => !is_null($this->user->id), 'user' => $this->user, 'ip' => $this->ip, ]; Mail::send( ['emails.error-html', 'emails.error'], $args, function (Message $message) use ($email) { if ($email != 'mail@example.com') { $message->to($email, $email)->subject('Caught an error in Firely III.'); } } ); } catch (Swift_TransportException $e) { // could also not mail! :o Log::error('Swift Transport Exception' . $e->getMessage()); } catch (ErrorException $e) { Log::error('ErrorException ' . $e->getMessage()); } Log::debug('Successfully handled error.'); } } }