예제 #1
0
파일: Pop3Worker.cs 프로젝트: radtek/BootFX
        /// <summary>
        /// Processes the messages.
        /// </summary>
        /// <param name="settings"></param>
        public void ProcessAllMessages(Pop3ConnectionSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            // connect...
            using (IPop3Provider provider = MailProviderFactory.GetPop3Provider())
            {
                // connect...
                provider.Connect(settings);

                // mbr - 15-11-2005 - info...
                if (this.Log.IsInfoEnabled)
                {
                    this.Log.Info(string.Format("POP3 account '{0}' on '{1}' has '{2}' message(s).", settings.Username, settings.HostName, provider.MessageCount));
                }

                // get them...
                ArrayList done = new ArrayList();
                try
                {
                    for (int index = 0; index < provider.MessageCount; index++)
                    {
                        // add...
                        done.Add(index);

                        // get it...
                        MailMessage message = provider.GetMessage(index);
                        if (message == null)
                        {
                            throw new InvalidOperationException("message is null.");
                        }

                        // defer it for processing...
                        this.ProcessMessage(message);
                    }
                }
                finally
                {
                    foreach (int index in done)
                    {
                        provider.DeleteMessage(index);
                    }
                }
            }
        }
예제 #2
0
 public void Connect(Pop3ConnectionSettings settings)
 {
 }