mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
smtp: add notify_email field; fix admin notification sent to no-reply sender
This commit is contained in:
@@ -34,12 +34,13 @@ if ($section === 'formulaire') {
|
||||
App::flash('success', "Types de travaux mis à jour.");
|
||||
} elseif ($section === 'smtp') {
|
||||
$smtpData = [
|
||||
'host' => $_POST['smtp_host'] ?? '',
|
||||
'port' => $_POST['smtp_port'] ?? 587,
|
||||
'encryption' => $_POST['smtp_encryption'] ?? 'tls',
|
||||
'username' => $_POST['smtp_username'] ?? '',
|
||||
'from_email' => $_POST['smtp_from_email'] ?? '',
|
||||
'from_name' => $_POST['smtp_from_name'] ?? 'XAMXAM',
|
||||
'host' => $_POST['smtp_host'] ?? '',
|
||||
'port' => $_POST['smtp_port'] ?? 587,
|
||||
'encryption' => $_POST['smtp_encryption'] ?? 'tls',
|
||||
'username' => $_POST['smtp_username'] ?? '',
|
||||
'from_email' => $_POST['smtp_from_email'] ?? '',
|
||||
'from_name' => $_POST['smtp_from_name'] ?? 'XAMXAM',
|
||||
'notify_email' => $_POST['smtp_notify_email'] ?? '',
|
||||
];
|
||||
// Only update password when user actually typed something.
|
||||
$pwd = $_POST['smtp_password'] ?? '';
|
||||
|
||||
@@ -188,9 +188,9 @@ try {
|
||||
);
|
||||
$plain = htmlToPlain($body);
|
||||
|
||||
$settings = SmtpRelay::getSettings($db);
|
||||
if (!empty($settings['from_email'])) {
|
||||
SmtpRelay::send($db, $settings['from_email'], $subject, $body, $plain);
|
||||
$notifyEmail = SmtpRelay::getNotifyEmail($db);
|
||||
if ($notifyEmail !== '') {
|
||||
SmtpRelay::send($db, $notifyEmail, $subject, $body, $plain);
|
||||
}
|
||||
|
||||
http_response_code(200);
|
||||
|
||||
Reference in New Issue
Block a user