private void SaveSMTP() { string fileName = Path.Combine(MainForm.serviceFolder, "Settings_" + MainForm.userName + ".ini"); IniFile iniFile = new IniFile(fileName); string section = "SMTP"; iniFile.Write(section, "Sender", mailSMTP.SenderName); iniFile.Write(section, "Address", mailSMTP.EmailAddress); iniFile.Write(section, "Server", mailSMTP.SMTPServer); iniFile.Write(section, "Port", mailSMTP.Port); iniFile.Write(section, "User", mailSMTP.UserName); iniFile.Write(section, "Security", mailSMTP.ConnectionSecurity); iniFile.Write(section, "Authentication", mailSMTP.AuthenticationMathod); if (mailSMTP.Password.Length == 0) { iniFile.Write(section, "Password", ""); } else { StringEncryption enc = new StringEncryption(); iniFile.Write(section, "Password", enc.Encrypt(mailSMTP.Password)); } }
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", ""); }
private void SaveExchange() { string fileName = Path.Combine(MainForm.serviceFolder, "Settings_" + MainForm.userName + ".ini"); IniFile iniFile = new IniFile(fileName); string section = "Exchange"; iniFile.Write(section, "User", mailExchange.User); if (mailExchange.Password.Length == 0) { iniFile.Write(section, "Password", ""); } else { StringEncryption enc = new StringEncryption(); iniFile.Write(section, "Password", enc.Encrypt(mailExchange.Password)); } iniFile.Write(section, "ServerURL", mailExchange.ServerURL); iniFile.Write(section, "Domain", mailExchange.Domain); iniFile.Write(section, "Email", mailExchange.Email); }