예제 #1
0
        /// <summary>
        /// Return a new instance of SmtpClient initializate with the values for the company smtpClient specifies in smtpClientType
        /// </summary>
        /// <param name="smtpClientType">smtpClient company type</param>
        /// <returns></returns>
        public static SmtpClient GetSmtpClient(SmtpClientType smtpClientType)
        {
            switch (smtpClientType)
            {
            case SmtpClientType.Gmail:
                return(Gmail);

            default:
                AppLogger.Error(String.Format("stmpClientType '{0}' not supported", smtpClientType));
                throw new ArgumentException(String.Format("stmpClientType '{0}' not supported", smtpClientType));
            }
        }
예제 #2
0
 public Email(String userName, String userPassword, SmtpClientType clientType)
 {
     _smtpClient             = SmtpClientFactory.GetSmtpClient(clientType);
     _smtpClient.Credentials = new NetworkCredential(userName, userPassword);
 }