Created
May 18, 2009 19:27
-
-
Save KevM/113693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
using (var pop3 = CreatePop3Connection(account)) | |
{ | |
_logger.LogDebug("Mailbox has {0} new messages.", pop3.InboxMessageCount); | |
foreach (MailMessage mailMessage in pop3.DownloadEntireMessages()) | |
{ | |
_logger.LogDebug("Email received from {0} with id {1}", mailMessage.From.Email, mailMessage.MessageID); | |
var emailMessage = _emailMessageAssembler.Assemble(mailMessage); | |
emailProcessor(emailMessage); | |
pop3.DeleteMessage(mailMessage.IndexOnServer); | |
} | |
pop3.Disconnect(); | |
_logger.LogDebug("Disconnected from pop3 server."); | |
} | |
} | |
catch (Exception exception) | |
{ | |
_logger.LogError("An error occurred getting email for {0}.", account); | |
_logger.LogException(exception); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment