Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="provider"></param>
        public void SetProperty(EmailServiceProvider provider)
        {
            String serverName = "";
            Int32  port       = Default.Port;
            SmtpEncryptedCommunication encryptedCommunication = SmtpEncryptedCommunication.None;

            switch (provider)
            {
            case EmailServiceProvider.Gmail: serverName = "smtp.gmail.com"; encryptedCommunication = SmtpEncryptedCommunication.Tls; break;

            case EmailServiceProvider.Outlook: serverName = "smtp-mail.outlook.com"; encryptedCommunication = SmtpEncryptedCommunication.Tls; break;

            case EmailServiceProvider.YahooMail: serverName = "smtp.mail.yahoo.com"; encryptedCommunication = SmtpEncryptedCommunication.Ssl; break;

            case EmailServiceProvider.AolMail: serverName = "smtp.aol.com"; encryptedCommunication = SmtpEncryptedCommunication.Tls; break;

            case EmailServiceProvider.ZohoMail: serverName = "smtp.zoho.com"; encryptedCommunication = SmtpEncryptedCommunication.Ssl; break;

            default: throw new InvalidOperationException();
            }
            this.ServerName = serverName;

            switch (encryptedCommunication)
            {
            case SmtpEncryptedCommunication.None: port = 25; break;

            case SmtpEncryptedCommunication.Ssl: port = 465; break;

            case SmtpEncryptedCommunication.Tls: port = 587; break;

            default: throw new InvalidOperationException();
            }
            this.Port = port;
            this.EncryptedCommunication = encryptedCommunication;
        }
 public SmtpClientDefaultSettings()
 {
     this.Port                   = 25;
     this.SslPort                = 443;
     this.HostName               = "localhost";
     this.AuthenticateMode       = SmtpAuthenticateMode.Auto;
     this.EncryptedCommunication = SmtpEncryptedCommunication.None;
 }