private void GetSMTP() { string fileName = Path.Combine(MainForm.serviceFolder, "Settings_" + MainForm.userName + ".ini"); IniFile iniFile = new IniFile(fileName); string section = "SMTP"; mailSMTP.SenderName = iniFile.ReadString(section, "Sender", ""); mailSMTP.EmailAddress = iniFile.ReadString(section, "Address", ""); mailSMTP.SMTPServer = iniFile.ReadString(section, "Server", ""); mailSMTP.Port = iniFile.ReadInteger(section, "Port", 25); mailSMTP.UserName = iniFile.ReadString(section, "User", ""); mailSMTP.ConnectionSecurity = iniFile.ReadString(section, "Security", "None"); mailSMTP.AuthenticationMathod = iniFile.ReadString(section, "Authentication", "No authentication"); string s = iniFile.ReadString(section, "Password", ""); if (s.Length == 0) { mailSMTP.Password = s; } else { StringEncryption enc = new StringEncryption(); mailSMTP.Password = enc.Decrypt(s); } }
private void GetExchange() { string fileName = Path.Combine(MainForm.serviceFolder, "Settings_" + MainForm.userName + ".ini"); IniFile iniFile = new IniFile(fileName); string section = "Exchange"; mailExchange.User = iniFile.ReadString(section, "User", ""); string s = iniFile.ReadString(section, "Password", ""); if (s.Length == 0) { mailExchange.Password = s; } else { StringEncryption enc = new StringEncryption(); mailExchange.Password = enc.Decrypt(s); } mailExchange.ServerURL = iniFile.ReadString(section, "ServerURL", ""); mailExchange.Domain = iniFile.ReadString(section, "Domain", ""); mailExchange.Email = iniFile.ReadString(section, "Email", ""); }