Improve mailer error handling for the send_email function.

This commit is contained in:
FusionPBX
2021-10-27 09:43:24 -06:00
committed by GitHub
parent a680892060
commit fc35482f74

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
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. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -1504,7 +1504,14 @@ function number_pad($number,$n) {
} }
//send the email //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->ClearAddresses();
$mail->SmtpClose(); $mail->SmtpClose();
unset($mail); unset($mail);