My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
HowTo  
How to configure SidePOP
Featured
Updated Dec 18, 2009 by trueblu...@gmail.com

Introduction

SidePOP can be configured with an XMLConfigurator. At some point there will be a configuration through database as well. You can also do registration yourself (ConfigureWithoutConfigurator).

Xml Configuration

Below you will see two accounts in the configuration. The first one contains the required items.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="sidepop" type="sidepop.configuration.SidePOPConfiguration, sidepop"/>
  </configSections>

  <!-- 110 is normal POP3 SSL uses port 995-->
  <sidepop>
    <accounts>
      <add hostName="mail.somewere.net" userName="someone@somewhere.com" password="" />
      <add name="Number1" description="Main account" enabled="false" hostName="mail.somewhere.net" hostPort="110" useSSL="false" userName="" password="" minutesBetweenChecks="1" timeoutInMinutes="1" />
    </accounts>
  </sidepop>
</configuration>

You may want to encrypt this section as it does ask for passwords.

Code for handling a list of messages at a time

        private void configure_mail_watcher()
        {
            EmailWatcherConfigurator configurator = new SidePopXmlConfigurator();
            foreach (EmailWatcher emailWatcher in configurator.configure())
            {
                emailWatcher.MessagesReceived += runner_messages_received;
                emailWatcher.start();
            }
        }

        private void runner_messages_received(object sender, MessageListEventArgs e)
        {
            IEnumerable<SidePOPMailMessage> messages = e.Messages;

            foreach (SidePOPMailMessage message in messages)
            {
                //your code here...
            }
        }

Code for handling a message at a time

        private static void configure_mail_watcher_single()
        {
            EmailWatcherConfigurator configurator = new SidePopXmlConfigurator();
            foreach (EmailWatcher emailWatcher in configurator.configure())
            {
                emailWatcher.MessageReceived += runner_message_received;
                emailWatcher.start();
            }
        }

        private static void runner_message_received(object sender, MessageEventArgs e)
        {
            SidePOPMailMessage message = e.Message;

            // your code here
        }

Sign in to add a comment
Powered by Google Project Hosting