From fc35482f74c2290c124fe53b0b7b613af8137929 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 27 Oct 2021 09:43:24 -0600 Subject: [PATCH] Improve mailer error handling for the send_email function. --- resources/functions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index a8e45e92a8..4c32b8e452 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2020 + Portions created by the Initial Developer are Copyright (C) 2008-2021 the Initial Developer. All Rights Reserved. Contributor(s): @@ -1504,7 +1504,14 @@ function number_pad($number,$n) { } //send the email - $mail->Send(); + if (!$mail->Send()) { + if (isset($mail->ErrorInfo) && strlen($mail->ErrorInfo) > 0) { + $mailer_error = $mail->ErrorInfo; + } + return false; + } + + //cleanup the mail object $mail->ClearAddresses(); $mail->SmtpClose(); unset($mail);