public static bool Test(MailBox account) { var ingoing_client = account.Imap ? (BaseProtocolClient)MailClientBuilder.Imap() : MailClientBuilder.Pop(); Test(ingoing_client, new MailServerSettings { Url = account.Server, Port = account.Port, AccountName = account.Account, AccountPass = account.Password, AuthenticationType = account.AuthenticationTypeIn, EncryptionType = account.IncomingEncryptionType, MailServerOperationTimeoutInMilliseconds = 10000 }); var outgoing_client = MailClientBuilder.Smtp(); Test(outgoing_client, new MailServerSettings { Url = account.SmtpServer, Port = account.SmtpPort, AccountName = account.SmtpAccount, AccountPass = account.SmtpPassword, AuthenticationType = account.AuthenticationTypeSmtp, EncryptionType = account.OutcomingEncryptionType, MailServerOperationTimeoutInMilliseconds = 10000 }); return(true); }
public static bool Test(MailBox account) { BaseProtocolClient ingoing_client = (account.Imap) ? (BaseProtocolClient)MailClientBuilder.Imap() : MailClientBuilder.Pop(); MailServerHelper.Test(ingoing_client, new MailServerSettings { Url = account.Server, Port = account.Port, AccountName = account.Account, AccountPass = account.Password, AuthenticationType = account.AuthenticationTypeIn, EncryptionType = account.IncomingEncryptionType }); MailServerHelper.TestSmtp(new MailServerSettings { Url = account.SmtpServer, Port = account.SmtpPort, AccountName = account.SmtpAccount, AccountPass = account.SmtpPassword, AuthenticationType = account.AuthenticationTypeSmtp, EncryptionType = account.OutcomingEncryptionType }); return(true); }
public static bool TryTestImap(MailServerSettings settings, out string last_error) { try { last_error = String.Empty; return(Test(MailClientBuilder.Imap(), settings)); } catch (Exception ex) { last_error = ex.Message; return(false); } }