Often times we need to process mails in a mailbox and based on the subject or message body, take actions in back-end systems. This was a project to process POP3 mailbox using c# implemented as a Windows Service. You can use TCP/IP to connect and process mails on a POP3 server. If your server requires SSL, use SSLStream on top the existing TCP stream to establish communication with the server. Sending commands to POP3 server is quite simple as writing the command (eg "DELE\r\n") to the TCP/IP socket and check the response.
Unlike IMAP, pop3 server doesn't keep track for message status (read/unread) so you cannot just fetch all unready message from the server. Once you are done with processing, delete the mail or keep track of the message guids to exclude in the next batch.
In this program, I am fetching all messages into an array and then sort them based on sent date. All attachments are saved to the file system and a handler is saved in the database.
The windows service that hosts this library has a timer which calls the StartMailBoxProcessor code on a user defined time intervals. This service is deployed to two servers with fail over capability.
download code
-paul