fix smtp
This commit is contained in:
parent
006b58e405
commit
c93374d10a
@ -81,7 +81,7 @@ public class SmtpSettingsController : ControllerBase
|
||||
|
||||
_permissionContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
|
||||
|
||||
var settingConfig = _mapper.Map<SmtpSettingsDto, SmtpSettings>(inDto);
|
||||
var settingConfig = ToSmtpSettingsConfig(inDto);
|
||||
|
||||
_coreConfiguration.SmtpSettings = settingConfig;
|
||||
|
||||
@ -91,6 +91,26 @@ public class SmtpSettingsController : ControllerBase
|
||||
return settings;
|
||||
}
|
||||
|
||||
private SmtpSettings ToSmtpSettingsConfig(SmtpSettingsDto inDto)
|
||||
{
|
||||
var settingsConfig = new SmtpSettings(
|
||||
inDto.Host,
|
||||
inDto.Port ?? SmtpSettings.DefaultSmtpPort,
|
||||
inDto.SenderAddress,
|
||||
inDto.SenderDisplayName)
|
||||
{
|
||||
EnableSSL = inDto.EnableSSL,
|
||||
EnableAuth = inDto.EnableAuth
|
||||
};
|
||||
|
||||
if (inDto.EnableAuth)
|
||||
{
|
||||
settingsConfig.SetCredentials(inDto.CredentialsUserName, inDto.CredentialsUserPassword);
|
||||
}
|
||||
|
||||
return settingsConfig;
|
||||
}
|
||||
|
||||
[HttpDelete("smtp")]
|
||||
public SmtpSettingsDto ResetSmtpSettings()
|
||||
{
|
||||
|
@ -143,6 +143,8 @@ public class SmtpJob : DistributedTaskProgress
|
||||
PublishChanges();
|
||||
|
||||
client.Send(FormatOptions.Default, mimeMessage);
|
||||
|
||||
Percentage = 100;
|
||||
}
|
||||
catch (AuthorizingException authError)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user