remove SMTP Relay setting
This commit is contained in:
@@ -258,15 +258,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="relay" HelpText="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." ResourceKey="SmtpRelay">Allow Sender Delegation? </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<select id="relay" class="form-select" @bind="@_smtprelay" required>
|
|
||||||
<option value="True">@SharedLocalizer["Yes"]</option>
|
|
||||||
<option value="False">@SharedLocalizer["No"]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -528,7 +519,6 @@
|
|||||||
private string _togglesmtpclientsecret = string.Empty;
|
private string _togglesmtpclientsecret = string.Empty;
|
||||||
private string _smtpscopes = string.Empty;
|
private string _smtpscopes = string.Empty;
|
||||||
private string _smtpsender = string.Empty;
|
private string _smtpsender = string.Empty;
|
||||||
private string _smtprelay = "False";
|
|
||||||
private int _retention = 30;
|
private int _retention = 30;
|
||||||
|
|
||||||
private string _pwaisenabled;
|
private string _pwaisenabled;
|
||||||
@@ -647,7 +637,6 @@
|
|||||||
_togglesmtpclientsecret = SharedLocalizer["ShowPassword"];
|
_togglesmtpclientsecret = SharedLocalizer["ShowPassword"];
|
||||||
_smtpscopes = SettingService.GetSetting(settings, "SMTPScopes", string.Empty);
|
_smtpscopes = SettingService.GetSetting(settings, "SMTPScopes", string.Empty);
|
||||||
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
||||||
_smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False");
|
|
||||||
_retention = int.Parse(SettingService.GetSetting(settings, "NotificationRetention", "30"));
|
_retention = int.Parse(SettingService.GetSetting(settings, "NotificationRetention", "30"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +829,6 @@
|
|||||||
settings = SettingService.SetSetting(settings, "SMTPClientSecret", _smtpclientsecret, true);
|
settings = SettingService.SetSetting(settings, "SMTPClientSecret", _smtpclientsecret, true);
|
||||||
settings = SettingService.SetSetting(settings, "SMTPScopes", _smtpscopes, true);
|
settings = SettingService.SetSetting(settings, "SMTPScopes", _smtpscopes, true);
|
||||||
settings = SettingService.SetSetting(settings, "SMTPSender", _smtpsender, true);
|
settings = SettingService.SetSetting(settings, "SMTPSender", _smtpsender, true);
|
||||||
settings = SettingService.SetSetting(settings, "SMTPRelay", _smtprelay, true);
|
|
||||||
settings = SettingService.SetSetting(settings, "NotificationRetention", _retention.ToString(), true);
|
settings = SettingService.SetSetting(settings, "NotificationRetention", _retention.ToString(), true);
|
||||||
|
|
||||||
if (_smtpenabled == "True")
|
if (_smtpenabled == "True")
|
||||||
|
|||||||
@@ -339,12 +339,6 @@
|
|||||||
<data name="HomePage.Text" xml:space="preserve">
|
<data name="HomePage.Text" xml:space="preserve">
|
||||||
<value>Home Page:</value>
|
<value>Home Page:</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SmtpRelay.HelpText" xml:space="preserve">
|
|
||||||
<value>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.</value>
|
|
||||||
</data>
|
|
||||||
<data name="SmtpRelay.Text" xml:space="preserve">
|
|
||||||
<value>Allow Sender Delegation?</value>
|
|
||||||
</data>
|
|
||||||
<data name="SiteMap.HelpText" xml:space="preserve">
|
<data name="SiteMap.HelpText" xml:space="preserve">
|
||||||
<value>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.</value>
|
<value>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.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -170,17 +170,7 @@ namespace Oqtane.Infrastructure
|
|||||||
fromName = string.IsNullOrEmpty(fromName) ? user.DisplayName ?? "" : fromName;
|
fromName = string.IsNullOrEmpty(fromName) ? user.DisplayName ?? "" : fromName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fromName = string.IsNullOrEmpty(fromName) ? site.Name : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get recipient from user information if "to" email or name is not specified and user id is available
|
// 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)
|
if ((string.IsNullOrEmpty(toEmail) || string.IsNullOrEmpty(toName)) && notification.ToUserId != null)
|
||||||
@@ -199,29 +189,29 @@ namespace Oqtane.Infrastructure
|
|||||||
MailboxAddress replyTo = null;
|
MailboxAddress replyTo = null;
|
||||||
var mailboxAddressValidationError = "";
|
var mailboxAddressValidationError = "";
|
||||||
|
|
||||||
// sender
|
// always send from SMTP Sender
|
||||||
if (MailboxAddress.TryParse(fromEmail, out from))
|
if (MailboxAddress.TryParse(settingRepository.GetSettingValue(settings, "SMTPSender", ""), out from))
|
||||||
{
|
{
|
||||||
from.Name = fromName; //override with "from" name set previously
|
from.Name = fromName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mailboxAddressValidationError += $" Invalid Sender: {fromName} <{fromEmail}>";
|
mailboxAddressValidationError += $" Invalid Sender: {fromName} <{settingRepository.GetSettingValue(settings, "SMTPSender", "")}>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// reply to
|
// 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
|
// recipient
|
||||||
if (MailboxAddress.TryParse(toEmail, out to))
|
if (MailboxAddress.TryParse(toEmail, out to))
|
||||||
{
|
{
|
||||||
to.Name = toName; //override with "to" name set previously
|
to.Name = toName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user