Ejemplo n.º 1
0
        public bool Equals(SmtpServerConfig other)
        {
            // If parameter is null, return false.
            if (other is null)
            {
                return(false);
            }

            // Optimization for a common success case.
            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            // If run-time types are not exactly the same, return false.
            if (this.GetType() != other.GetType())
            {
                return(false);
            }

            // Return true if the fields match.
            return((this.Account == other.Account) &&
                   (this.Password == other.Password) &&
                   (this.Host == other.Host) &&
                   (this.Port == other.Port) &&
                   (this.DeliveryMethod == other.DeliveryMethod) &&
                   (this.UseDefaultCredentials == other.UseDefaultCredentials) &&
                   (this.EnableSsl == other.EnableSsl));
        }
Ejemplo n.º 2
0
        public EmailService(SmtpServerConfig smtpServerConfig)
        {
            SmtpConfig = smtpServerConfig;

            lazySmtpServer = new Lazy <SmtpClient>(() => new SmtpClient {
                DeliveryMethod = SmtpConfig.DeliveryMethod,
                Credentials    = new NetworkCredential(SmtpConfig.Account, SmtpConfig.Password),
                Host           = SmtpConfig.Host,
                Port           = Convert.ToInt32(SmtpConfig.Port),
                EnableSsl      = SmtpConfig.EnableSsl
            });
        }