Add from to phpmailer

This commit is contained in:
Fred Tempez 2023-02-25 22:00:24 +01:00
parent 4fb4d17210
commit 0dd310970f

View File

@ -1115,12 +1115,12 @@ class common
$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']);
$mail->setFrom($this->getData(['config', 'smtp', 'username']));
if (is_null($replyTo)) { if (is_null($replyTo)) {
$mail->addReplyTo($this->getData(['config', 'smtp', 'username'])); $mail->addReplyTo($this->getData(['config', 'smtp', 'username']));
} else { } else {
@ -1130,7 +1130,8 @@ class common
// Fin SMTP // Fin SMTP
} else { } else {
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']); $host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
$mail->setFrom('no-reply@' . $host, $this->getData(['locale', 'title'])); $from = $from ? $from : 'no-reply@' . $host;
$mail->setFrom($from, $this->getData(['locale', 'title']));
if (is_null($replyTo)) { if (is_null($replyTo)) {
$mail->addReplyTo('no-reply@' . $host, $this->getData(['locale', 'title'])); $mail->addReplyTo('no-reply@' . $host, $this->getData(['locale', 'title']));
} else { } else {