public TweetAppRepository(IMongoClient client, IOptions <SMTPConfig> smtpConfig) { var database = client.GetDatabase("TweetDB"); _users = database.GetCollection <User>("User_Details"); _tweets = database.GetCollection <Tweet>("Tweet"); _smtpConfig = smtpConfig.Value; }
public TimedHostedService(ILogger <TimedHostedService> logger, IOptions <AppSettings> appSettings, IOptions <KnowageHeaders> headers, IOptions <URLs> urls, IOptions <Paths> paths, IOptions <SMTPConfig> smtp) { _logger = logger; AppSettings _appSettings1 = appSettings.Value; KnowageHeaders _headers = headers.Value; URLs _urls = urls.Value; Paths _paths = paths.Value; SMTPConfig _smtp = smtp.Value; }
public void setSMTPDefault() { subjectTxt.Text = SMTPConfig.GetUserConfig("subject"); mail1TextBox.Text = SMTPConfig.GetUserConfig("mail1"); mail2TextBox.Text = SMTPConfig.GetUserConfig("mail2"); mail3TextBox.Text = SMTPConfig.GetUserConfig("mail3"); mail4TextBox.Text = SMTPConfig.GetUserConfig("mail4"); mail5TextBox.Text = SMTPConfig.GetUserConfig("mail5"); hostmailTextBox.Text = SMTPConfig.GetUserConfig("hostmail"); hostnameTextBox.Text = SMTPConfig.GetUserConfig("hostname"); portTextBox.Text = SMTPConfig.GetUserConfig("port"); ServerTxt.Text = SMTPConfig.GetUserConfig("server"); }
public CommunicationController(IEmailService EmailService, IConfiguration Config) { this._EmailService = EmailService; this._SMTPConfig = new SMTPConfig { InboxEmail = Config["GreatBlackMomsContactUsEmail"], MainEmail = Config["MainEmail"], MailPass = Config["MainMailPass"], Server = Config["SMTPServer"], Port = Convert.ToInt32(Config["SMTPPort"]) }; this._Config = Config; }
protected void Button1_Click(object sender, EventArgs e) { SMTPConfig.SetUserConfig("subject", subjectTxt.Text); SMTPConfig.SetUserConfig("mail1", mail1TextBox.Text); SMTPConfig.SetUserConfig("mail2", mail2TextBox.Text); SMTPConfig.SetUserConfig("mail3", mail3TextBox.Text); SMTPConfig.SetUserConfig("mail4", mail4TextBox.Text); SMTPConfig.SetUserConfig("mail5", mail5TextBox.Text); SMTPConfig.SetUserConfig("hostmail", hostmailTextBox.Text); SMTPConfig.SetUserConfig("hostname", hostnameTextBox.Text); SMTPConfig.SetUserConfig("port", portTextBox.Text); SMTPConfig.SetUserConfig("server", ServerTxt.Text); Label2.Text = "資料更新成功"; }
public SMTPConfig GetSMTPConfig() { SMTPConfig currentSMTPConfig = new SMTPConfig(); try { /** Ins Modell wird die SMTP Config aus der Datenbank geladen **/ currentSMTPConfig = _smtpConfigDB.GetSMTPConfig(); } catch (Exception ex) { Log4net.Logger.Error(ex.Message); } return(currentSMTPConfig); }
public void Initialise(IConfigSource config) { m_Config = config; IConfig SMTPConfig; //FIXME: RegionName is correct?? //m_RegionName = scene.RegionInfo.RegionName; IConfig startupConfig = m_Config.Configs["Startup"]; m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule"); //Load SMTP SERVER config try { if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { m_Enabled = false; return; } if (!SMTPConfig.GetBoolean("enabled", false)) { m_Enabled = false; return; } m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname); SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME); SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); } catch (Exception e) { m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); m_Enabled = false; return; } }
public SMTPConfig GetSMTPConfig() { SMTPConfig currentSMTPConfig = new SMTPConfig(); string url = _restUrl + "/SMTPConfig/GetSMTPConfig"; try { /** WebRequest wird generiert über meine URL **/ WebRequest request = WebRequest.Create(url); request.Timeout = 20000; /** Credentials sind optional, jedoch werden sie hierbei benötigt * aufgrund der Authentification **/ request.Credentials = CredentialCache.DefaultCredentials; request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(_username + ":" + _password)); /** Response **/ WebResponse response = request.GetResponse(); using (Stream dataStream = response.GetResponseStream()) { StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); /** Ergebnis wird in Modell geladen **/ currentSMTPConfig = JsonConvert.DeserializeObject <SMTPConfig>(responseFromServer); } /** Response immer schließen **/ response.Close(); } catch (Exception ex) { throw ex; } return(currentSMTPConfig); }
public void Initialize(IConfigSource config, IRegistryCore registry) { m_Config = config; //Load SMTP SERVER config try { IConfig SMTPConfig; if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { //MainConsole.Instance.InfoFormat("[SMTP] SMTP server not configured"); m_Enabled = false; return; } m_Enabled = SMTPConfig.GetBoolean("enabled", true); if (!m_Enabled) { m_Enabled = false; return; } m_localOnly = SMTPConfig.GetBoolean("local_only", true); m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname); SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME); SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); SMTP_SERVER_MONO_CERT = SMTPConfig.GetBoolean("SMTP_SERVER_MONO_CERT", SMTP_SERVER_MONO_CERT); m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); registry.RegisterModuleInterface <IEmailModule>(this); MainConsole.Instance.InfoFormat("[SMTP] Email enabled for {0}", m_localOnly ? "Local only" : "Full service"); } catch (Exception e) { MainConsole.Instance.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); m_Enabled = false; } }
/** Methode gibt die SMTP_Config Tabelle zurück **/ private SMTPConfig getSmtpConfig() { SMTPConfig currentSMTPConfig = new SMTPConfig(); DataTable smtpConfigTable = new DataTable(); string sqlQuery = ""; try { sqlQuery = "GetSMTPConfig"; /** SQL Select Statement gibt die Tabelle "SMTP_Config" zurück **/ smtpConfigTable = _sqlManager.ExecuteSelect(sqlQuery, new string[] { }, new object[] { }); /** Tabelle wird in einer Schleife durchlaufen und ins Modell geladen **/ if (smtpConfigTable.Rows.Count > 0) { for (int i = 0; i < smtpConfigTable.Rows.Count; i++) { currentSMTPConfig.Id = Convert.ToInt64(smtpConfigTable.Rows[i]["ID"]); currentSMTPConfig.MailFrom = (smtpConfigTable.Rows[i]["MailFrom"].ToString()); currentSMTPConfig.MailTo = (smtpConfigTable.Rows[i]["MailTo"].ToString()); currentSMTPConfig.Password = (smtpConfigTable.Rows[i]["Password"].ToString()); currentSMTPConfig.Subject = (smtpConfigTable.Rows[i]["Subject"].ToString()); currentSMTPConfig.SMTPServer = (smtpConfigTable.Rows[i]["SMTPServer"].ToString()); currentSMTPConfig.SMTPPort = Convert.ToInt32((smtpConfigTable.Rows[i]["SMTPPort"].ToString())); currentSMTPConfig.CreationDate = (DateTime)smtpConfigTable.Rows[i]["CreationDate"]; } } } catch (Exception ex) { throw ex; } return(currentSMTPConfig); }
public void Initialise(IConfigSource config) { m_Config = config; IConfig SMTPConfig; //Load SMTP SERVER config try { if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { m_log.InfoFormat("[SMTP] SMTP server not configured"); m_Enabled = false; return; } m_Enabled = SMTPConfig.GetBoolean("enabled", true); if (!m_Enabled) { //m_log.InfoFormat("[SMTP] module disabled in configuration"); m_Enabled = false; return; } m_localOnly = SMTPConfig.GetBoolean("local_only", true); m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname); SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME); SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); } catch (Exception e) { m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); m_Enabled = false; return; } }
public SMTPDB() { _currentSmtpConfig = new SMTPConfig(); _sqlManager = new SQL(); }
public EmailSender(AppSettings appSettings) { _smtpConfig = appSettings.SMTPConfig; SendError = false; }
// inject SMTPConfig From service. IConfig (register) => IOption (receive) public EmailService(IOptions <SMTPConfig> smtpConfig) { _smtpConfig = smtpConfig.Value; }
public async Task <bool> SendContactUsEmail(ContactUsEmailDto contactUsEmailDto, SMTPConfig config) { using (var client = new SmtpClient(config.Server) { Port = config.Port, EnableSsl = true, UseDefaultCredentials = false, Credentials = new NetworkCredential(config.MainEmail, config.MailPass) }) { try { MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress(config.InboxEmail); mailMessage.To.Add(config.MainEmail); mailMessage.Subject = "Message From your Contact Us Page on GreatBlackMoms.org"; mailMessage.Body = "The following is a message received from your contact us page(Email: " + contactUsEmailDto.FromAddress + " Name: " + contactUsEmailDto.NameOfRecipient + "): " + contactUsEmailDto.Message; await client.SendMailAsync(mailMessage); return(true); } catch (Exception ex) { //return false; throw ex; } } }
public void Initialize(Scene scene, IConfigSource config) { m_Config = config; IConfig SMTPConfig; //FIXME: RegionName is correct?? //m_RegionName = scene.RegionInfo.RegionName; IConfig startupConfig = m_Config.Configs["Startup"]; m_Enabled = (startupConfig.GetString("getemailmodule", "DefaultGetEmailModule") == "DefaultGetEmailModule"); //Load SMTP SERVER config try { if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { m_log.ErrorFormat("[InboundEmail]: SMTP not configured"); m_Enabled = false; return; } if (!SMTPConfig.GetBoolean("inbound", true)) { m_log.WarnFormat("[InboundEmail]: Inbound email module disabled in configuration"); m_Enabled = false; return; } // Database support _connectString = SMTPConfig.GetString("inbound_storage_connection", String.Empty); if (String.IsNullOrEmpty(_connectString)) { m_log.ErrorFormat("[InboundEmail]: Could not find SMTP inbound_storage_connection."); m_Enabled = false; return; } _connectionFactory = new ConnectionFactory("MySQL", _connectString); if (_connectionFactory == null) { m_log.ErrorFormat("[InboundEmail]: Inbound email module could not create MySQL connection."); m_Enabled = false; return; } } catch (Exception e) { m_log.Error("[InboundEmail]: Inbound email not configured: " + e.Message); m_log.Error(e.StackTrace); m_Enabled = false; return; } // It's a go! if (m_Enabled) { lock (m_Scenes) { // Claim the interface slot scene.RegisterModuleInterface <IGetEmailModule>(this); // Add to scene list if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) { m_Scenes[scene.RegionInfo.RegionHandle] = scene; } else { m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); } } m_log.Info("[InboundEmail]: Activated inbound email."); } }
/// <summary> /// this method actually send mail, both static and dynamic.... and save info in MailAttachment.... /// </summary> /// <param name="mails"></param> /// <param name="AD_User_ID"></param> /// <param name="AD_Client_ID"></param> /// <param name="AD_Org_ID"></param> /// <param name="attachment_ID"></param> /// <param name="fileNames"></param> /// <param name="fileNameForOpenFormat"></param> /// <param name="mailFormat"></param> /// <param name="notify"></param> /// <returns></returns> public string SendMailstart(List <NewMailMessage> mails, int AD_User_ID, int AD_Client_ID, int AD_Org_ID, int attachment_ID, List <string> fileNames, List <string> fileNameForOpenFormat, string mailFormat, bool notify, VAdvantage.Utility.EMail sendmails, List <int> documentID) { if (ctx == null) { return(null); } UserInformation userinfo = new UserInformation(); SMTPConfig config = null; config = MailConfigMethod.GetUSmtpConfig(AD_User_ID, ctx); // var config = ""; if (config == null) { MClient client = new MClient(ctx, AD_Client_ID, null); userinfo.Email = client.GetRequestEMail(); } else { //Add user info to list.. userinfo.Email = config.Email; } string[] to = null; string[] bc = null; string[] cc = null; string sub = null; string message = null; // int _record_id = 0; int _table_id = 0; string[] records = null; StringBuilder res = new StringBuilder(); List <NewMailMessage> mail = mails.GetRange(0, mails.Count); for (int j = 0; j < mails.Count; j++) { VAdvantage.Utility.EMail sendmail = new VAdvantage.Utility.EMail(ctx, "", "", "", "", "", "", true, false); to = mails[j].To.Split(';'); bc = mails[j].Bcc; cc = mails[j].Cc.Split(';'); StringBuilder bcctext = new StringBuilder(); sub = mails[j].Subject; message = mailFormat; if (mails[j].Body != null && mails[j].Body.Count > 0) { List <string> keysss = mails[j].Body.Keys.ToList(); for (int q = 0; q < keysss.Count; q++) { message = message.Replace(keysss[q], mails[j].Body[keysss[q]]); } } if (mails[j].Recordids != null) //in case of static mail { records = mails[j].Recordids.Split(','); } _table_id = Convert.ToInt32(mail[j].TableID); VAdvantage.Model.MMailAttachment1 _mAttachment = new VAdvantage.Model.MMailAttachment1(ctx, 0, null); if (sub == null || sub.Length == 0 || sub == "") { sendmail.SetSubject("."); // pass validation } else { sendmail.SetSubject(sub); } sendmail.SetMessageHTML(message); //used to get attachments uploaded by user..... if (mail[j].AttachmentFolder != null && mail[j].AttachmentFolder.Trim().Length > 0) { string storedAttachmentPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, AttachmentsUploadFolderName + "\\" + mail[j].AttachmentFolder); if (Directory.Exists(storedAttachmentPath)) { DirectoryInfo info = new DirectoryInfo(storedAttachmentPath); if (info.GetFiles().Length > 0) { FileInfo[] files = info.GetFiles(); for (int a = 0; a < files.Length; a++) { if (fileNames.Contains(files[a].Name)) { FileStream attachmentStream = File.OpenRead(files[a].FullName); BinaryReader binary = new BinaryReader(attachmentStream); byte[] buffer = binary.ReadBytes((int)attachmentStream.Length); sendmail.AddAttachment(buffer, files[a].Name); _mAttachment.AddEntry(files[a].Name, buffer); } } } } } //used to get attachments of saved formats.. Currently not Supporting...... if (attachment_ID > 0) { VAdvantage.Model.MMailAttachment1 _mAttachment1 = new VAdvantage.Model.MMailAttachment1(ctx, attachment_ID, null); if (_mAttachment1.GetEntryCount() > 0) { MAttachmentEntry[] entries = _mAttachment1.GetEntries(); for (int m = 0; m < entries.Count(); m++) { //if (fileNameForOpenFormat.Contains(entries[m].GetName())) //{ byte[] buffer = entries[m].GetData(); sendmail.AddAttachment(buffer, entries[m].GetName()); _mAttachment.AddEntry(entries[m].GetName(), buffer); //} } } } if (documentID != null || documentID.Count > 0) { for (int i = 0; i < documentID.Count; i++) { try { int attachmentID = AttachmentID(documentID[i]); //MAttachment objAttachment = new MAttachment(ctx, attachmentID, null, Common.GetPassword(), ctx.GetAD_Client_ID()); //objAttachment.Force = false; ////objAttachment.AD_Client_ID = ctx.GetAD_Client_ID(); //byte[] fileByte = objAttachment.GetEntryData(0); //string fileName = objAttachment.GetEntryName(0); List <AttachedFileInfo> lstAttchments = GetBytes(ctx, attachmentID, ""); sendmail.AddAttachment(lstAttchments[0].FileBytes, lstAttchments[0].FileName); } catch (Exception ex) { res.Append(Msg.GetMsg(ctx, "VADMS_AttachmentNotFound for : " + documentID[i]) + ex.Message); } } } if (to != null) { for (int i = 0; i < to.Length; i++) { if (to[i].ToString() != "") { sendmail.AddTo(to[i].ToString(), ""); // totext.Append(to[i].ToString() + ","); } } } if (bc != null) { for (int i = 0; i < bc.Length; i++) { if (bc[i].ToString() != "") { sendmail.AddBcc(bc[i].ToString(), ""); bcctext.Append(bc[i].ToString() + ","); } } } if (cc != null) { for (int i = 0; i < cc.Length; i++) { if (cc[i].ToString() != "") { sendmail.AddCc(cc[i].ToString(), ""); /// cctext.Append(cc[i].ToString() + ","); } } } string res1 = sendmail.Send(); if (records != null && records.Length > 0)//save entery in MailAttachment...... { for (int k = 0; k < records.Length; k++) { if (records[k] == null || records[k] == "" || records[k] == "0") { continue; } if (res1 != "OK") { _mAttachment.SetIsMailSent(false); } else { _mAttachment.SetIsMailSent(true); } int AD_Client_Id = ctx.GetAD_Client_ID(); int iOrgid = ctx.GetAD_Org_ID(); _mAttachment.SetAD_Client_ID(AD_Client_Id); _mAttachment.SetAD_Org_ID(iOrgid); _mAttachment.SetAD_Table_ID(_table_id); _mAttachment.IsActive(); _mAttachment.SetMailAddress(bcctext.ToString()); _mAttachment.SetAttachmentType("M"); _mAttachment.SetRecord_ID(Convert.ToInt32(records[k])); _mAttachment.SetTextMsg(message); _mAttachment.SetTitle(sub); _mAttachment.SetMailAddressBcc(bcctext.ToString()); _mAttachment.SetMailAddress(mails[j].To); _mAttachment.SetMailAddressCc(mails[j].Cc); _mAttachment.SetMailAddressFrom(userinfo.Email); if (_mAttachment.GetEntries().Length > 0) { _mAttachment.SetIsAttachment(true); } else { _mAttachment.SetIsAttachment(false); } _mAttachment.NewRecord(); if (_mAttachment.Save()) { } else { // log.SaveError(Msg.GetMsg(Env.GetCtx(), "RecordNotSaved"), ""); } } } if (res1 != "OK") // if mail not sent.... { if (res1 == "AuthenticationFailed.") { res.Append("AuthenticationFailed"); return(res.ToString()); } else if (res1 == "ConfigurationIncompleteOrNotFound") { res.Append("ConfigurationIncompleteOrNotFound"); return(res.ToString()); } else { res.Append(" " + Msg.GetMsg(ctx, "MailNotSentTo") + ": " + mails[j].To + " " + bcctext + " " + mails[j].Cc); } } else { { if (!res.ToString().Contains("MailSent")) { res.Append("MailSent"); } } } bcctext = null; } if (notify) // make an entry in Notice window..... { MNote note = new MNote(ctx, "SentMailNotice", AD_User_ID, AD_Client_ID, AD_Org_ID, null); // Reference note.SetReference(ToString()); // Document // Text note.SetTextMsg(res.ToString()); note.Save(); } userinfo = null; cc = null; bc = null; to = null; records = null; sub = null; message = null; records = null; return(res.ToString()); }
public MailManager() { _currentSMTPConfig = new SMTPConfig(); _currentContact = new Contact(); }
public async Task <bool> SendResearchRegistrationEmail(ContactUsEmailDto contactUsEmailDto, SMTPConfig config) { using (var client = new SmtpClient(config.Server) { Port = config.Port, EnableSsl = true, UseDefaultCredentials = false, Credentials = new NetworkCredential(config.MainEmail, config.MailPass) }) { try { var mailAddress = new MailAddress("*****@*****.**"); var mailMessage = new MailMessage() { From = mailAddress, Subject = "Research Registration", Body = $"The following email address has requested to register for your current research {contactUsEmailDto.FromAddress}" }; mailMessage.To.Add("*****@*****.**"); client.Send(mailMessage); var senderMailMessage = new MailMessage() { From = mailAddress, Subject = "Your Registration For Research", Body = $"This email is just confirming that you've registered for a research at GreatBlackMoms.org. You will be contacted as soon as possible at this email address about moving forward if you've been selected. {Environment.NewLine} Thank you for you registering!" }; senderMailMessage.To.Add(contactUsEmailDto.FromAddress); await client.SendMailAsync(senderMailMessage); return(true); } catch { return(false); throw; } } }
public static void Configure(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _smtpConfig = _serviceProvider.GetRequiredService <SMTPConfig>(); }
//Toast Notification in the upper right after donating in Donate Page public Funds4SafetyController(ApplicationDbContext context, IOptions <SMTPConfig> smtpConfig, IToastNotification toastNotification) { _context = context; _smtpConfig = smtpConfig.Value; _toastNotification = toastNotification; }
public void Initialise(Scene scene, IConfigSource config) { m_Config = config; IConfig SMTPConfig; //FIXME: RegionName is correct?? //m_RegionName = scene.RegionInfo.RegionName; IConfig startupConfig = m_Config.Configs["Startup"]; m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule"); //Load SMTP SERVER config try { if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) { m_log.InfoFormat("[SMTP] SMTP server not configured"); m_Enabled = false; return; } if (!SMTPConfig.GetBoolean("enabled", false)) { m_log.InfoFormat("[SMTP] module disabled in configuration"); m_Enabled = false; return; } m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); m_InterObjectHostname = SMTPConfig.GetString("internal_object_host", m_InterObjectHostname); SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME", SMTP_SERVER_HOSTNAME); SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); } catch (Exception e) { m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); m_Enabled = false; return; } // It's a go! if (m_Enabled) { lock (m_Scenes) { // Claim the interface slot scene.RegisterModuleInterface <IEmailModule>(this); // Add to scene list if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) { m_Scenes[scene.RegionInfo.RegionHandle] = scene; } else { m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); } } m_log.Info("[EMAIL] Activated DefaultEmailModule"); } }
public MailService(IOptions <SMTPConfig> options) { _SMTPConfig = options.Value; }
public EmailSender(IOptions <AuthMessageSenderOptions> optionsAccessor, SMTPConfig smtpConfig) { this.smtpConfig = smtpConfig; Options = optionsAccessor.Value; }