/// <summary> /// Initializes a new instance of the <see cref="EmailSender"/> class. /// Use <see cref="settings"/> property to configure email subject and sender information. /// </summary> /// <param name="settings">The settings.</param> public EmailSender(EmailAndSmtpSetting settings) { if (settings == null) { settings = Utilities.SystemSettings?.EmailAndSmtpSetting ?? new EmailAndSmtpSetting(); } this.Settings = settings; }
static Emailer() { var settings = Utilities.SystemSettings; EmailAndSmtpSetting = settings.EmailAndSmtpSetting; ApplicationName = settings.ApplicationName; EmailLogMessages = settings.EmailLogMessages; Logger = Utilities.Logger; }
/// <summary> /// Gets an email account instance. A new one is created; as opposed to reading from DB /// </summary> /// <param name="Settings">The settings.</param> /// <returns></returns> public static EmailAccount ToEmailAccount(this EmailAndSmtpSetting Settings) { return(new EmailAccount { DisplayName = Settings.DefaultSenderDisplayName, Username = Settings.SmtpUsername, Password = Settings.SmtpPassword, Host = Settings.SmtpHost, Port = Settings.SmtpPort, EnableSsl = Settings.EnableSSL, UseDefaultCredentials = false, Email = Settings.DefaultEmailSender }); }