-
October 1st, 2011, 08:25 PM
#1
Need help with OpenPop
Hey,
I am using OpenPop to read through the emails on my Hotmail account. What I want my code to do is display the HTML link in my email and display it in a listBox but its not working. Can you help?:
Code:
///Start POP3 connection
Pop3Client client = new Pop3Client();
//Login to email
client.Connect("pop3.live.com", 995, true);
client.Authenticate("USER", "PASS");
label18.Text = client.GetMessageCount().ToString();
int messageCount = client.GetMessageCount();
for (int i = 1; i <= messageCount; i++)
{
// Download the header and check if the message is interesting
// enough to download if with body
MessageHeader header = client.GetMessageHeaders(i);
if ("Wordpress".Contains(header.Subject))
{
// The message is interesting - download it
OpenPop.Mime.Message message = client.GetMessage(i);
// Find the first part containing HTML
// null is returned if such part is not found
MessagePart html = message.FindFirstHtmlVersion();
if (html != null)
{
String htmlContained = html.GetBodyAsText();
// Do something with the html
// here showing it in a listbox
listBox2.Items.Add(htmlContained);
}
}
}
client.Disconnect();
-
October 1st, 2011, 09:06 PM
#2
Re: Need help with OpenPop
Have you tried stepping through the code in a debugger to see what's failing?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|