forked from ZwiiCMS-Team/ZwiiCMS
core sendmail fix
This commit is contained in:
parent
7eebe5e6ef
commit
fbe047c877
@ -1108,36 +1108,34 @@ class common
|
|||||||
$mail->CharSet = 'UTF-8';
|
$mail->CharSet = 'UTF-8';
|
||||||
// Mail
|
// Mail
|
||||||
try {
|
try {
|
||||||
// Paramètres SMTP
|
// Paramètres SMTP perso
|
||||||
if ($this->getdata(['config', 'smtp', 'enable'])) {
|
if ($this->getdata(['config', 'smtp', 'enable'])) {
|
||||||
//$mail->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_SERVER;
|
//$mail->SMTPDebug = PHPMailer\PHPMailer\SMTP::DEBUG_SERVER;
|
||||||
$mail->isSMTP();
|
$mail->isSMTP();
|
||||||
$mail->SMTPAutoTLS = false;
|
$mail->SMTPAutoTLS = false;
|
||||||
$mail->Host = $this->getdata(['config', 'smtp', 'host']);
|
$mail->Host = $this->getdata(['config', 'smtp', 'host']);
|
||||||
$mail->Port = (int) $this->getdata(['config', 'smtp', 'port']);
|
$mail->Port = (int) $this->getdata(['config', 'smtp', 'port']);
|
||||||
|
|
||||||
if ($this->getData(['config', 'smtp', 'auth'])) {
|
if ($this->getData(['config', 'smtp', 'auth'])) {
|
||||||
$mail->Username = $this->getData(['config', 'smtp', 'username']);
|
$mail->Username = $this->getData(['config', 'smtp', 'username']);
|
||||||
$mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password']));
|
$mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password']));
|
||||||
$mail->SMTPAuth = $this->getData(['config', 'smtp', 'auth']);
|
$mail->SMTPAuth = $this->getData(['config', 'smtp', 'auth']);
|
||||||
$mail->SMTPSecure = $this->getData(['config', 'smtp', 'secure']);
|
$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 {
|
// Expéditeur
|
||||||
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
||||||
$from = $from ? $from : 'no-reply@' . $host;
|
$from = $from ? $from : 'no-reply@' . $host;
|
||||||
$mail->setFrom($from, $this->getData(['locale', 'title']));
|
$mail->setFrom($from, $this->getData(['locale', 'title']));
|
||||||
|
|
||||||
|
// répondre à
|
||||||
if (is_null($replyTo)) {
|
if (is_null($replyTo)) {
|
||||||
$mail->addReplyTo('no-reply@' . $host, $this->getData(['locale', 'title']));
|
$mail->addReplyTo($from, $this->getData(['locale', 'title']));
|
||||||
} else {
|
} else {
|
||||||
$mail->addReplyTo($replyTo);
|
$mail->addReplyTo($replyTo);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Destinataires
|
||||||
if (is_array($to)) {
|
if (is_array($to)) {
|
||||||
foreach ($to as $userMail) {
|
foreach ($to as $userMail) {
|
||||||
$mail->addAddress($userMail);
|
$mail->addAddress($userMail);
|
||||||
|
@ -773,7 +773,9 @@ class blog extends common
|
|||||||
'Nouveau commentaire déposé',
|
'Nouveau commentaire déposé',
|
||||||
'Bonjour' . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
|
'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>',
|
'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)
|
if ($sent === false)
|
||||||
$error++;
|
$error++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user