refactor: improve SMS and email handling in Message class; add success/failure return values and update language file with new translations

This commit is contained in:
Focuslinkstech
2025-04-09 10:29:22 +01:00
parent f0b9b56bb0
commit 3347b39f3b
3 changed files with 164 additions and 4 deletions

View File

@ -46,7 +46,7 @@ class Message
$txts = str_split($txt, 160);
try {
foreach ($txts as $txt) {
self::sendSMS( $phone, $txt);
self::sendSMS($phone, $txt);
self::logMessage('SMS', $phone, $txt, 'Success');
}
} catch (Throwable $e) {
@ -140,6 +140,7 @@ class Message
}
mail($to, $subject, $body, $attr);
self::logMessage('Email', $to, $body, 'Success');
return true;
} else {
$mail = new PHPMailer();
$mail->isSMTP();
@ -188,8 +189,10 @@ class Message
if (!$mail->send()) {
$errorMessage = Lang::T("Email not sent, Mailer Error: ") . $mail->ErrorInfo;
self::logMessage('Email', $to, $body, 'Error', $errorMessage);
return false;
} else {
self::logMessage('Email', $to, $body, 'Success');
return true;
}
//<p style="font-family: Helvetica, sans-serif; font-size: 16px; font-weight: normal; margin: 0; margin-bottom: 16px;">