Beispiel #1
0
        public MailBox(int tenant, string user, string name,
                       MailAddress email, string account, string password, string server, bool imap,
                       string smtpServer, string smtpPassword, bool smtpauth, int mailboxId, DateTime beginDate,
                       EncryptionType incomingEncryptionType, EncryptionType outcomingEncryptionType, byte service,
                       string refreshToken, string emailInFolder, bool isRemoved)
        {
            if (string.IsNullOrEmpty(user))
            {
                throw new ArgumentNullException("user");
            }
            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 (!smtpServer.Contains(":"))
            {
                throw new FormatException("Valid server string format is <server:port>");
            }

            MailLimitedTimeDelta = DefaultMailLimitedTimeDelta;
            MailBeginTimestamp   = new DateTime(DefaultMailBeginTimestamp);

            MailBoxId  = mailboxId;
            TenantId   = tenant;
            UserId     = user;
            EMail      = email;
            Account    = account;
            Name       = name;
            Server     = server.Split(':')[0];
            Port       = int.Parse(server.Split(':')[1]);
            SmtpServer = smtpServer.Split(':')[0];
            SmtpPort   = int.Parse(smtpServer.Split(':')[1]);
            SmtpAuth   = smtpauth;
            Imap       = imap;

            Password                = password;
            SmtpPassword            = smtpPassword;
            IncomingEncryptionType  = incomingEncryptionType;
            OutcomingEncryptionType = outcomingEncryptionType;
            ServerLoginDelay        = DefaultServerLoginDelay;
            BeginDate               = beginDate;
            Restrict                = !(BeginDate.Equals(MailBeginTimestamp));
            ServiceType             = service;
            RefreshToken            = refreshToken;
            ImapIntervals           = new ImapIntervalsType();
            EMailInFolder           = emailInFolder;
            IsRemoved               = isRemoved;
        }
Beispiel #2
0
 public MailBox()
 {
     ServerLoginDelay = DefaultServerLoginDelay; //This value can be changed in test mailbox connection
     ImapIntervals    = new ImapIntervalsType();
 }