added ability to disable SMTP and set IsBodyHtml by default
This commit is contained in:
parent
6183d6a22e
commit
261adefbc7
|
@ -145,9 +145,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="enabledSSl" HelpText="Specify if SSL is required for your SMTP server" ResourceKey="UseSsl">SSL Enabled: </Label>
|
<Label Class="col-sm-3" For="smtpssl" HelpText="Specify if SSL is required for your SMTP server" ResourceKey="UseSsl">SSL Enabled: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select id="enabledSSl" class="form-select" @bind="@_smtpssl" >
|
<select id="smtpssl" class="form-select" @bind="@_smtpssl" >
|
||||||
<option value="True">@SharedLocalizer["Yes"]</option>
|
<option value="True">@SharedLocalizer["Yes"]</option>
|
||||||
<option value="False">@SharedLocalizer["No"]</option>
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -183,6 +183,15 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="smtpenabled" HelpText="Specify if SMTP is enabled for this site" ResourceKey="SMTPEnabled">Enabled? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="smtpenabled" class="form-select" @bind="@_smtpenabled">
|
||||||
|
<option value="True">@SharedLocalizer["Yes"]</option>
|
||||||
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="retention" HelpText="Number of days of notifications to retain" ResourceKey="Retention">Retention (Days): </Label>
|
<Label Class="col-sm-3" For="retention" HelpText="Number of days of notifications to retain" ResourceKey="Retention">Retention (Days): </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
@ -354,6 +363,7 @@
|
||||||
private string _togglesmtppassword = string.Empty;
|
private string _togglesmtppassword = string.Empty;
|
||||||
private string _smtpsender = string.Empty;
|
private string _smtpsender = string.Empty;
|
||||||
private string _smtprelay = "False";
|
private string _smtprelay = "False";
|
||||||
|
private string _smtpenabled = "True";
|
||||||
private string _retention = string.Empty;
|
private string _retention = string.Empty;
|
||||||
private string _pwaisenabled;
|
private string _pwaisenabled;
|
||||||
private int _pwaappiconfileid = -1;
|
private int _pwaappiconfileid = -1;
|
||||||
|
@ -434,6 +444,7 @@
|
||||||
_togglesmtppassword = SharedLocalizer["ShowPassword"];
|
_togglesmtppassword = SharedLocalizer["ShowPassword"];
|
||||||
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
||||||
_smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False");
|
_smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False");
|
||||||
|
_smtpenabled = SettingService.GetSetting(settings, "SMTPEnabled", "True");
|
||||||
_retention = SettingService.GetSetting(settings, "NotificationRetention", "30");
|
_retention = SettingService.GetSetting(settings, "NotificationRetention", "30");
|
||||||
|
|
||||||
// aliases
|
// aliases
|
||||||
|
@ -600,6 +611,7 @@
|
||||||
settings = SettingService.SetSetting(settings, "SMTPPassword", _smtppassword, true);
|
settings = SettingService.SetSetting(settings, "SMTPPassword", _smtppassword, 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, "SMTPRelay", _smtprelay, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "SMTPEnabled", _smtpenabled, true);
|
||||||
settings = SettingService.SetSetting(settings, "NotificationRetention", _retention, true);
|
settings = SettingService.SetSetting(settings, "NotificationRetention", _retention, true);
|
||||||
await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
|
await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
|
||||||
|
|
||||||
|
|
|
@ -369,4 +369,10 @@
|
||||||
<data name="PageContent.Heading" xml:space="preserve">
|
<data name="PageContent.Heading" xml:space="preserve">
|
||||||
<value>Page Content</value>
|
<value>Page Content</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SMTPEnabled.HelpText" xml:space="preserve">
|
||||||
|
<value>Specify if SMTP is enabled for this site</value>
|
||||||
|
</data>
|
||||||
|
<data name="SMTPEnabled.Text" xml:space="preserve">
|
||||||
|
<value>Enabled?</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -42,6 +42,8 @@ namespace Oqtane.Infrastructure
|
||||||
// get site settings
|
// get site settings
|
||||||
List<Setting> sitesettings = settingRepository.GetSettings(EntityNames.Site, site.SiteId).ToList();
|
List<Setting> sitesettings = settingRepository.GetSettings(EntityNames.Site, site.SiteId).ToList();
|
||||||
Dictionary<string, string> settings = GetSettings(sitesettings);
|
Dictionary<string, string> settings = GetSettings(sitesettings);
|
||||||
|
if (!settings.ContainsKey("SMTPEnabled") || settings["SMTPEnabled"] == "True")
|
||||||
|
{
|
||||||
if (settings.ContainsKey("SMTPHost") && settings["SMTPHost"] != "" &&
|
if (settings.ContainsKey("SMTPHost") && settings["SMTPHost"] != "" &&
|
||||||
settings.ContainsKey("SMTPPort") && settings["SMTPPort"] != "" &&
|
settings.ContainsKey("SMTPPort") && settings["SMTPPort"] != "" &&
|
||||||
settings.ContainsKey("SMTPSSL") && settings["SMTPSSL"] != "" &&
|
settings.ContainsKey("SMTPSSL") && settings["SMTPSSL"] != "" &&
|
||||||
|
@ -133,6 +135,7 @@ namespace Oqtane.Infrastructure
|
||||||
// encoding
|
// encoding
|
||||||
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
|
mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
|
||||||
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;
|
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;
|
||||||
|
mailMessage.IsBodyHtml = true;
|
||||||
|
|
||||||
// send mail
|
// send mail
|
||||||
try
|
try
|
||||||
|
@ -157,6 +160,11 @@ namespace Oqtane.Infrastructure
|
||||||
log += "SMTP Not Configured Properly In Site Settings - Host, Port, SSL, And Sender Are All Required" + "<br />";
|
log += "SMTP Not Configured Properly In Site Settings - Host, Port, SSL, And Sender Are All Required" + "<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log += "SMTP Disabled In Site Settings" + "<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user