Exemplo n.º 1
0
        /// <summary>
        /// Method for retrieve the mail messages for POP3 protocol.
        /// </summary>
        /// <param name="beginIndex">The begin index for retrieve the message.</param>
        /// <param name="increment">The increment for begin index for retrieve messages.</param>
        /// <returns>The mail messages.</returns>
        public BindingList <MailMessage> RetrieveMessages(int beginIndex, int increment)
        {
            BindingList <MailMessage> ret = new BindingList <MailMessage>();

            MailMessage mailMessage;
            Header      header;

            int messageCount = this._pop3Client.MessageCount;

            for (int i = beginIndex; i <= beginIndex + increment; i++)
            {
                if (i <= messageCount)
                {
                    header      = this._pop3Client.RetrieveHeaderObject(i);
                    mailMessage = new MailMessage();
                    mailMessage.FillMessage(header);
                    mailMessage.BaseIndex = i;
                    ret.Add(mailMessage);
                }
            }
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method for retrieve the mail messages for IMAP4 protocol.
        /// </summary>
        /// <param name="mailbox">The mailbox for retrieve messages.</param>
        /// <param name="beginIndex">The begin index for retrieve the messages.</param>
        /// <param name="increment">The increment for begin index for retrieve the messages.</param>
        /// <returns>The mail messages.</returns>
        public BindingList <MailMessage> RetrieveMessages(string mailbox, int beginIndex, int increment)
        {
            BindingList <MailMessage> ret = new BindingList <MailMessage>();

            MailMessage mailMessage;
            Header      header;

            Mailbox inbox        = this._imap4Client.SelectMailbox(mailbox);
            Fetch   fetch        = inbox.Fetch;
            int     messageCount = inbox.MessageCount;

            for (int i = beginIndex; i <= beginIndex + increment; i++)
            {
                if (i <= messageCount)
                {
                    header      = fetch.HeaderObject(i);
                    mailMessage = new MailMessage();
                    mailMessage.FillMessage(header);
                    mailMessage.BaseIndex = i;
                    ret.Add(mailMessage);
                }
            }
            return(ret);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method for retrieve the mail messages for IMAP4 protocol.
        /// </summary>
        /// <param name="mailbox">The mailbox for retrieve messages.</param>
        /// <param name="beginIndex">The begin index for retrieve the messages.</param>
        /// <param name="increment">The increment for begin index for retrieve the messages.</param>
        /// <returns>The mail messages.</returns>
        public BindingList<MailMessage> RetrieveMessages(string mailbox, int beginIndex, int increment)
        {
            BindingList<MailMessage> ret = new BindingList<MailMessage>();

            MailMessage mailMessage;
            Header header;

            Mailbox inbox = this._imap4Client.SelectMailbox(mailbox);
            Fetch fetch = inbox.Fetch;
            int messageCount = inbox.MessageCount;
            for (int i = beginIndex; i <= beginIndex + increment; i++)
            {
                if (i <= messageCount)
                {
                    header = fetch.HeaderObject(i);
                    mailMessage = new MailMessage();
                    mailMessage.FillMessage(header);
                    mailMessage.BaseIndex = i;
                    ret.Add(mailMessage);
                }
            }
            return ret;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Method for retrieve the mail messages for POP3 protocol.
        /// </summary>
        /// <param name="beginIndex">The begin index for retrieve the message.</param>
        /// <param name="increment">The increment for begin index for retrieve messages.</param>
        /// <returns>The mail messages.</returns>
        public BindingList<MailMessage> RetrieveMessages(int beginIndex, int increment)
        {
            BindingList<MailMessage> ret = new BindingList<MailMessage>();

            MailMessage mailMessage;
            Header header;

            int messageCount = this._pop3Client.MessageCount;
            for (int i = beginIndex; i <= beginIndex + increment; i++)
            {
                if (i <= messageCount)
                {
                    header = this._pop3Client.RetrieveHeaderObject(i);
                    mailMessage = new MailMessage();
                    mailMessage.FillMessage(header);
                    mailMessage.BaseIndex = i;
                    ret.Add(mailMessage);
                }
            }
            return ret;
        }