From 79fa054c32f9c58c7cc27539755365535f3c0aec Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 1 Aug 2016 12:17:53 +0200 Subject: Error when sending email when invoice is not generated yet --- include/ajax-email-offer.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ajax-email-offer.php b/include/ajax-email-offer.php index c8a09c0..0f3476b 100644 --- a/include/ajax-email-offer.php +++ b/include/ajax-email-offer.php @@ -19,8 +19,13 @@ require_once(__DIR__ . '/../login-ajax.php'); -$_offer = new Offer($_pdo, $_REQUEST['id']); -$_mailer = $_offer->mailer(); +try { + $_offer = new Offer($_pdo, $_REQUEST['id']); + $_mailer = $_offer->mailer(); +} catch (Exception $e) { + http_response_code(500); + die($e->getMessage()); +} function format_email($address) { if ($address[1] != '') { -- cgit v1.2.3