public SmtpClient(string host, int port, string email, string password, bool enableSsl) : this(host, port, enableSsl) { if (enableSsl) { client = new SmtpSslClient(host, port, email, password, AuthType); } else { client = new SmtpNoSslClient(host, port, email, password, AuthType); } IsAuthorized = client.IsAuthorized; }
public SmtpClient(string host, int port, bool enableSsl) { this.host = host; this.port = port; EnableSsl = enableSsl; if (enableSsl) { client = new SmtpSslClient(host, port); } else { client = new SmtpNoSslClient(host, port); } }
public bool Authorize(string email, string password) { if (host == null || port == null) { throw new ArgumentNullException(); } if (IsAuthorized) { throw new SmtpException.AuthFaildException("You are still authorize"); } if (EnableSsl) { client = new SmtpSslClient(host, port.Value, email, password, AuthType); } else { client = new SmtpNoSslClient(host, port.Value, email, password, AuthType); } IsAuthorized = client.IsAuthorized; return(IsAuthorized); }