Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Excepción al correo
<?php
[...]
/**
* Maneja las excepciones no capturadas
*
* @param Exception $e
* */
public static function handleException($e)
{
if ( ! PRODUCTION )
{
#die('<pre>'.print_r($e,1));
$body["MESSAGE"] = $e->getMessage() ? $e->getMessage() : $e->view;
$body["SERVER"] = $_SERVER["SERVER_NAME"] .':'.$_SERVER["SERVER_PORT"];
if ( ! empty($_SERVER["HTTP_REFERER"]) ) $body["HTTP_REFERER"] = $_SERVER["HTTP_REFERER"];
$body["REQUEST_URI"] = $_SERVER["REQUEST_URI"];
$body["REMOTE_ADDR"] = $_SERVER["REMOTE_ADDR"];
$body["REMOTE_USER"] = $_SERVER["REMOTE_USER"];
$body["HTTP_USER_AGENT"] = $_SERVER["HTTP_USER_AGENT"];
$to = 'AQUI_TU_EMAIL';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to, 'ERROR: '.$body["MESSAGE"], '<pre>'.print_r($body,1), $headers);
}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.