コード例 #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
ファイル: MockPop3Provider.cs プロジェクト: radtek/BootFX
 public void Connect(Pop3ConnectionSettings settings)
 {
 }