core sendmail fix

This commit is contained in:
Fred Tempez 2023-02-25 22:17:17 +01:00
parent 7eebe5e6ef
commit fbe047c877
2 changed files with 18 additions and 18 deletions

View File

@ -1108,36 +1108,34 @@ class common
$mail->CharSet = 'UTF-8';
// Mail
try {
// Paramètres SMTP
// Paramètres SMTP perso
if ($this->getdata(['config', 'smtp', 'enable'])) {
//$mail->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->SMTPAutoTLS = false;
$mail->Host = $this->getdata(['config', 'smtp', 'host']);
$mail->Port = (int) $this->getdata(['config', 'smtp', 'port']);
if ($this->getData(['config', 'smtp', 'auth'])) {
$mail->Username = $this->getData(['config', 'smtp', 'username']);
$mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password']));
$mail->SMTPAuth = $this->getData(['config', 'smtp', 'auth']);
$mail->SMTPSecure = $this->getData(['config', 'smtp', 'secure']);
if (is_null($replyTo)) {
$mail->addReplyTo($this->getData(['config', 'smtp', 'username']));
} else {
$mail->addReplyTo($replyTo);
}
}
// Fin SMTP
} else {
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
$from = $from ? $from : 'no-reply@' . $host;
$mail->setFrom($from, $this->getData(['locale', 'title']));
if (is_null($replyTo)) {
$mail->addReplyTo('no-reply@' . $host, $this->getData(['locale', 'title']));
} else {
$mail->addReplyTo($replyTo);
}
}
// Expéditeur
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
$from = $from ? $from : 'no-reply@' . $host;
$mail->setFrom($from, $this->getData(['locale', 'title']));
// répondre à
if (is_null($replyTo)) {
$mail->addReplyTo($from, $this->getData(['locale', 'title']));
} else {
$mail->addReplyTo($replyTo);
}
// Destinataires
if (is_array($to)) {
foreach ($to as $userMail) {
$mail->addAddress($userMail);

View File

@ -773,7 +773,9 @@ class blog extends common
'Nouveau commentaire déposé',
'Bonjour' . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
'L\'article <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire.<br><br>',
''
null,
$this->getData(['config', 'smtp', 'from']),
);
if ($sent === false)
$error++;