Ejemplo n.º 1
0
 protected ServerBase(ISmtpServerConf conf)
 {
     if (conf == null)
     {
         throw new ArgumentNullException(nameof(conf), "Config server is null");
     }
     if (!IsValidConfigServer(conf))
     {
         throw new ArgumentException("Config is valid", nameof(conf));
     }
     _ServerConf = conf;
 }
Ejemplo n.º 2
0
 protected virtual bool IsValidConfigServer(ISmtpServerConf conf)
 {
     if (string.IsNullOrEmpty(conf.Host))
     {
         throw new ArgumentException("Host cannot be is null or empty", nameof(conf.Host));
     }
     if (string.IsNullOrEmpty(conf.Password))
     {
         throw new ArgumentException("Password cannot be is null or empty", nameof(conf.Password));
     }
     if (conf.Port <= 0)
     {
         throw new ArgumentException("Port cannot be zero or less", nameof(conf.Port));
     }
     if (string.IsNullOrEmpty(conf.Username))
     {
         throw new ArgumentException("Username cannot is null or empty", nameof(conf.Username));
     }
     return(true);
 }
Ejemplo n.º 3
0
 public SmtpServer(ISmtpServerConf conf) : base(conf)
 {
 }