From 0dd310970f147f9ea6cb39984ac7d5668a40af57 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 25 Feb 2023 22:00:24 +0100 Subject: [PATCH] Add from to phpmailer --- core/core.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/core.php b/core/core.php index cac52d72..0b4ed358 100644 --- a/core/core.php +++ b/core/core.php @@ -1115,12 +1115,12 @@ class common $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']); - $mail->setFrom($this->getData(['config', 'smtp', 'username'])); if (is_null($replyTo)) { $mail->addReplyTo($this->getData(['config', 'smtp', 'username'])); } else { @@ -1130,7 +1130,8 @@ class common // Fin SMTP } else { $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)) { $mail->addReplyTo('no-reply@' . $host, $this->getData(['locale', 'title'])); } else {