Ejemplo n.º 1
0
        private static SmtpSettingsConfig ToSmtpSettingsConfig(SmtpSettingsModel settingsModel)
        {
            var settingsConfig = new SmtpSettingsConfig(settingsModel.Host, settingsModel.Port ?? SmtpSettingsConfig.DefaultSmtpPort,
                                                        settingsModel.SenderAddress, settingsModel.SenderDisplayName)
            {
                EnableSSL = settingsModel.EnableSSL
            };

            if (!string.IsNullOrEmpty(settingsModel.CredentialsUserName) && !string.IsNullOrEmpty(settingsModel.CredentialsUserPassword))
            {
                settingsConfig.SetCredentials(settingsModel.CredentialsUserName, settingsModel.CredentialsUserPassword);
            }

            return(settingsConfig);
        }
Ejemplo n.º 2
0
        private static SmtpSettingsConfig ToSmtpSettingsConfig(SmtpSettingsModel settingsModel)
        {
            var settingsConfig = new SmtpSettingsConfig(settingsModel.Host, settingsModel.Port ?? SmtpSettingsConfig.DefaultSmtpPort,
                                                        settingsModel.SenderAddress, settingsModel.SenderDisplayName)
                {
                    EnableSSL = settingsModel.EnableSSL
                };

            if (!string.IsNullOrEmpty(settingsModel.CredentialsUserName) && !string.IsNullOrEmpty(settingsModel.CredentialsUserPassword))
            {
                settingsConfig.SetCredentials(settingsModel.CredentialsUserName, settingsModel.CredentialsUserPassword);
            }
            
            return settingsConfig;
        }