From b0211b2e6e9223addf648593d4ade826e6a73098 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 19 Jan 2026 10:45:02 -0500 Subject: [PATCH] remove SMTP Relay setting --- Oqtane.Client/Modules/Admin/Site/Index.razor | 12 -------- .../Resources/Modules/Admin/Site/Index.resx | 6 ---- .../Infrastructure/Jobs/NotificationJob.cs | 28 ++++++------------- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor index 0852a754..d49d90ed 100644 --- a/Oqtane.Client/Modules/Admin/Site/Index.razor +++ b/Oqtane.Client/Modules/Admin/Site/Index.razor @@ -258,15 +258,6 @@ -
- -
- -
-
} else { @@ -528,7 +519,6 @@ private string _togglesmtpclientsecret = string.Empty; private string _smtpscopes = string.Empty; private string _smtpsender = string.Empty; - private string _smtprelay = "False"; private int _retention = 30; private string _pwaisenabled; @@ -647,7 +637,6 @@ _togglesmtpclientsecret = SharedLocalizer["ShowPassword"]; _smtpscopes = SettingService.GetSetting(settings, "SMTPScopes", string.Empty); _smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty); - _smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False"); _retention = int.Parse(SettingService.GetSetting(settings, "NotificationRetention", "30")); } @@ -840,7 +829,6 @@ settings = SettingService.SetSetting(settings, "SMTPClientSecret", _smtpclientsecret, true); settings = SettingService.SetSetting(settings, "SMTPScopes", _smtpscopes, true); settings = SettingService.SetSetting(settings, "SMTPSender", _smtpsender, true); - settings = SettingService.SetSetting(settings, "SMTPRelay", _smtprelay, true); settings = SettingService.SetSetting(settings, "NotificationRetention", _retention.ToString(), true); if (_smtpenabled == "True") diff --git a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx index 64d16606..3d41770b 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Site/Index.resx @@ -339,12 +339,6 @@ Home Page: - - This option will send email directly from the sender's unique email address rather than from the authorized Email Sender specified below. This option should only be used when the SMTP service has been configured with SPF/DKIM/DMARC for each unique sender, or else the email will be identified as malicious spoofing. - - - Allow Sender Delegation? - The site map url for this site which can be submitted to search engines for indexing. The sitemap is cached for 5 minutes and the cache can be manually cleared. diff --git a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs index 3114f9e7..5d0ba275 100644 --- a/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs +++ b/Oqtane.Server/Infrastructure/Jobs/NotificationJob.cs @@ -170,17 +170,7 @@ namespace Oqtane.Infrastructure fromName = string.IsNullOrEmpty(fromName) ? user.DisplayName ?? "" : fromName; } } - - // preserve reply to - var replyToEmail = fromEmail; - var replyToName = fromName; - - // SMTP Sender should always be used when Sender Delegation is disabled (default) or if the "from" email address is not specified (ie. system messages) - if (settingRepository.GetSettingValue(settings, "SMTPRelay", "False") != "True" || string.IsNullOrEmpty(fromEmail)) - { - fromEmail = settingRepository.GetSettingValue(settings, "SMTPSender", ""); - fromName = string.IsNullOrEmpty(fromName) ? site.Name : fromName; - } + fromName = string.IsNullOrEmpty(fromName) ? site.Name : fromName; // get recipient from user information if "to" email or name is not specified and user id is available if ((string.IsNullOrEmpty(toEmail) || string.IsNullOrEmpty(toName)) && notification.ToUserId != null) @@ -199,29 +189,29 @@ namespace Oqtane.Infrastructure MailboxAddress replyTo = null; var mailboxAddressValidationError = ""; - // sender - if (MailboxAddress.TryParse(fromEmail, out from)) + // always send from SMTP Sender + if (MailboxAddress.TryParse(settingRepository.GetSettingValue(settings, "SMTPSender", ""), out from)) { - from.Name = fromName; //override with "from" name set previously + from.Name = fromName; } else { - mailboxAddressValidationError += $" Invalid Sender: {fromName} <{fromEmail}>"; + mailboxAddressValidationError += $" Invalid Sender: {fromName} <{settingRepository.GetSettingValue(settings, "SMTPSender", "")}>"; } // reply to - if (!string.IsNullOrEmpty(replyToEmail) && replyToEmail != fromEmail) + if (!string.IsNullOrEmpty(fromEmail) && fromEmail != from.Address) { - if (MailboxAddress.TryParse(replyToEmail, out replyTo)) + if (MailboxAddress.TryParse(fromEmail, out replyTo)) { - replyTo.Name = replyToName; //override with "replyToName" name set previously + replyTo.Name = fromName; } } // recipient if (MailboxAddress.TryParse(toEmail, out to)) { - to.Name = toName; //override with "to" name set previously + to.Name = toName; } else {