public MailBox(int tenant_id, string username, string name, MailAddress email, string account, string password, string server, bool imap, string smtp_server, string smtp_password, bool smtpauth, int mailbox_id, DateTime begin_date, EncryptionType incoming_encryption_type, EncryptionType outcoming_encryption_type, byte service, string refresh_token, string email_in_folder) { if (string.IsNullOrEmpty(username)) { throw new ArgumentNullException("username"); } if (email == null) { throw new ArgumentNullException("email"); } if (string.IsNullOrEmpty(account)) { throw new ArgumentNullException("account"); } if (string.IsNullOrEmpty(server)) { throw new ArgumentNullException("server"); } if (!server.Contains(":")) { throw new FormatException("Valid server string format is <server:port>"); } if (!smtp_server.Contains(":")) { throw new FormatException("Valid server string format is <server:port>"); } MailLimitedTimeDelta = DefaultMailLimitedTimeDelta; MailBeginTimestamp = new DateTime(DefaultMailBeginTimestamp); MailBoxId = mailbox_id; TenantId = tenant_id; UserId = username; EMail = email; Account = account; Name = name; Server = server.Split(':')[0]; Port = int.Parse(server.Split(':')[1]); SmtpServer = smtp_server.Split(':')[0]; SmtpPort = int.Parse(smtp_server.Split(':')[1]); SmtpAuth = smtpauth; Imap = imap; Password = password; SmtpPassword = smtp_password; IncomingEncryptionType = incoming_encryption_type; OutcomingEncryptionType = outcoming_encryption_type; ServerLoginDelay = DefaultServerLoginDelay; BeginDate = begin_date; Restrict = !(BeginDate.Equals(MailBeginTimestamp)); ServiceType = service; RefreshToken = refresh_token; ImapFolders = new ImapFoldersType(); EMailInFolder = email_in_folder; }
public MailBox() { ServerLoginDelay = DefaultServerLoginDelay; //This value can be changed in test mailbox connection ImapFolders = new ImapFoldersType(); }