CMXX - Mailer update

This commit is contained in:
“VeLiTi”
2025-05-09 14:18:06 +02:00
parent da78217dd9
commit c20d2d9c6e
30 changed files with 4535 additions and 159 deletions

View File

@@ -50,19 +50,31 @@ function send_mail($to, $subject, $message, $attachment, $attachment_name){
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
//$mail->isSMTP(); // Use SMTP protocol
$mail->isSMTP(); // Use SMTP protocol
$mail->Host = email_host_name; // Specify SMTP server
$mail->SMTPAuth = true; // Auth. SMTP
$mail->Username = email; // Mail who send by PHPMailer
$mail->Password = email_outgoing_pw; // your pass mail box
$mail->SMTPSecure = email_outgoing_security; // Accept SSL
$mail->Port = email_outgoing_port; // port of your out server
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->setFrom(email, mail_from); // Mail to send at
$mail->addAddress($to); // Add sender
$mail->addReplyTo(email_reply_to); // Adress to reply
$mail->isHTML(true); // use HTML message
$mail->Subject = $subject;
$mail->Body = $message;
/* +++++++++++ //
// DEBUG MODE //
// +++++++++++ //
$mail->SMTPDebug = 4; // Or higher if needed
$mail->Debugoutput = function($str, $level) {
debuglog($str); // Your custom logger
};
// +++++++++++ //
// +++++++++++ */
if (!empty($attachment) || $attachment != ''){
$mail->AddStringAttachment($attachment, $attachment_name, 'base64', 'application/pdf');
}
@@ -71,7 +83,7 @@ function send_mail($to, $subject, $message, $attachment, $attachment_name){
if( !$mail->send() ){
// render error if it is
$tab = array('error' => 'Mailer Error: '.$mail->ErrorInfo );
echo json_encode($tab);
debuglog(json_encode($tab));
exit;
}
else{