0

On production server i would like to send myself an email every time an error ocurres. I'm now sending a basic mail but i would like to attach the rendered basic (orange) error page as a attached html file.

Any idea how to do that?

This is what i currently have:

App::error(function(Exception $exception, $code)
{
    Log::error($exception);

    $data = array('exception' => $exception);
    Mail::send('emails.error', $data, function($message)
    {
        $message->from(Config::get('app.debug_email'));
        $message->to(Config::get('app.debug_email'))->subject(Config::get('app.client_name') . ' Error');
    });

    if (!Config::get('app.debug')) {
        return Response::view('errors.index', $code);
    }
});
Jannick Vandaele
  • 963
  • 1
  • 7
  • 9
  • The `Whoops` output will not work in an email. Typically, the backtrace information shown is stored in your logs in plain text. – ceejayoz Aug 22 '14 at 12:38

1 Answers1

1

You really wouldn't want to do that to be honest, as emails do not generally support CSS, which is what that page uses.

You are best off just having the data emailed that contains the backtrace, the url and any input given so you can reproduce the error.

nesl247
  • 106
  • 3