Exemplo n.º 1
0
        private bool Equals(MailQueueItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            return(ReferenceEquals(this, other) || Equals(other.Account, Account));
        }
Exemplo n.º 2
0
 public void OnRetrieveNewMessage(MailQueueItem account,
     ActiveUp.Net.Mail.Message message,
     int folder_id,
     string uidl,
     string md5_hash,
     bool unread,
     int[] tags_ids)
 {
     if (mailBoxManager.MailReceive(account.Account, message, folder_id, uidl, md5_hash, unread, tags_ids) < 1)
         throw new Exception("MailReceive() returned id < 1;");
 }
Exemplo n.º 3
0
 public void OnRetrieveNewMessage(MailQueueItem account,
                                  ActiveUp.Net.Mail.Message message,
                                  int folder_id,
                                  string uidl,
                                  string md5_hash,
                                  bool unread,
                                  int[] tags_ids)
 {
     if (mailBoxManager.MailReceive(account.Account, message, folder_id, uidl, md5_hash, unread, tags_ids) < 1)
     {
         throw new Exception("MailReceive() returned id < 1;");
     }
 }
Exemplo n.º 4
0
        public bool Test()
        {
            var item = new MailQueueItem(this);

            return(item.Test());
        }
Exemplo n.º 5
0
 public void OnDone(MailQueueItem item, bool quota_error)
 {
     mailBoxManager.SetMailboxQuotaError(item.Account, quota_error);
 }
Exemplo n.º 6
0
 public DateTime GetFolderModifyDate(MailQueueItem account, int folder_id)
 {
     return mailBoxManager.GetMailboxFolderModifyDate(account.Account.MailBoxId, folder_id);
 }
Exemplo n.º 7
0
 public void GetStoredMessagesUIDL_MD5(MailQueueItem account, Dictionary<int, string> uidl_list, Dictionary<int, string> md5_list)
 {
     mailBoxManager.GetStoredMessagesUIDL_MD5(account.Account.MailBoxId, uidl_list, md5_list);
 }
Exemplo n.º 8
0
 public void OnDone(MailQueueItem item, bool quota_error)
 {
     mailBoxManager.SetMailboxQuotaError(item.Account, quota_error);
 }
Exemplo n.º 9
0
 public DateTime GetFolderModifyDate(MailQueueItem account, int folder_id)
 {
     return(mailBoxManager.GetMailboxFolderModifyDate(account.Account.MailBoxId, folder_id));
 }
Exemplo n.º 10
0
 public void GetStoredMessagesUIDL_MD5(MailQueueItem account, Dictionary <int, string> uidl_list, Dictionary <int, string> md5_list)
 {
     mailBoxManager.GetStoredMessagesUIDL_MD5(account.Account.MailBoxId, uidl_list, md5_list);
 }
Exemplo n.º 11
0
        public static void TestIMAPReceiveMessage(string imap_server, string imap_account, string imap_password, int imap_port, bool use_ssl, string uidl)
        {
            var imap = MailClientBuilder.Imap();

            try
            {
                _log.Debug("Connecting to {0}", imap_account);

                var match = _imapUidlRegx.Match(uidl);

                if (!match.Success)
                {
                    _log.Error("Bad UIDL");
                    return;
                }

                var uid          = Convert.ToInt32(match.Groups[1].Value);
                var folder       = Convert.ToInt32(match.Groups[2].Value);
                var uid_validity = Convert.ToInt32(match.Groups[3].Value);

                if (use_ssl)
                {
                    imap.ConnectSsl(imap_server, imap_port);
                }
                else
                {
                    imap.Connect(imap_server, imap_port);
                }

                imap.Login(imap_account, imap_password, "");

                var folders = MailQueueItem.GetImapMailboxes(imap, imap_server);

                var founded = (from n in folders
                               where n.folder_id == folder
                               select n)
                              .FirstOrDefault();

                if (string.IsNullOrEmpty(founded.name))
                {
                    _log.Error("Bad UIDL folder");
                    return;
                }

                var mb = imap.SelectMailbox(founded.name);

                if (mb.UidValidity != uid_validity)
                {
                    _log.Error("Bad UID_VALIDITY");
                    return;
                }

                var message = mb.Fetch.UidMessageObject(uid);

                var mail_info = new MailMessageItem(message);

// ReSharper disable UnusedVariable
                var sanitazed = HtmlSanitizer.Sanitize(mail_info.HtmlBody, true);
// ReSharper restore UnusedVariable
            }
            catch (Pop3Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                try
                {
                    if (imap.IsConnected)
                    {
                        imap.Disconnect();
                    }
                }
                catch
                { }
            }
        }
Exemplo n.º 12
0
        private bool Equals(MailQueueItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            return ReferenceEquals(this, other) || Equals(other.Account, Account);
        }