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();