954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

OpenPop Help Needed...

Hows it going? In my program I want it to download certain messages, open them, find the HTML link, and at the moment want it to display it in a listBox. I am using the dll OpenPop for this. So far thats not happening and the only thing thats appearing in my listbox is text saying something like: "OpenPop.Mime.Header".

Heres my 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();
kytro360
Light Poster
37 posts since Aug 2011
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: