Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7970415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:23:47+00:00 2026-06-04T07:23:47+00:00

I am using OpenPop.net to try and parse our links from all the emails

  • 0

I am using OpenPop.net to try and parse our links from all the emails that are in a given inbox. I found this method to get all the message:

    public static List<OpenPop.Mime.Message> FetchAllMessages(string hostname, int port, bool useSsl, string username, string password)
    {
        // The client disconnects from the server when being disposed
        using (Pop3Client client = new Pop3Client())
        {
            // Connect to the server
            client.Connect(hostname, port, useSsl);

            // Authenticate ourselves towards the server
            client.Authenticate(username, password);

            // Get the number of messages in the inbox
            int messageCount = client.GetMessageCount();

            // We want to download all messages
            List<OpenPop.Mime.Message> allMessages = new List<OpenPop.Mime.Message>(messageCount);

            // Messages are numbered in the interval: [1, messageCount]
            // Ergo: message numbers are 1-based.
            // Most servers give the latest message the highest number
            for (int i = messageCount; i > 0; i--)
            {
                allMessages.Add(client.GetMessage(i));                    
            }

            client.Disconnect();

            // Now return the fetched messages
            return allMessages;
        }
    }

Now I am trying to loop through each message but I cannot seem to figure out how to do it, I have this so far for my button:

    private void button7_Click(object sender, EventArgs e)
    {

        List<OpenPop.Mime.Message> allaEmail = FetchAllMessages("pop3.live.com", 995, true, "xxxxx@hotmail.com", "xxxxx");

        var message = string.Join(",", allaEmail);
        MessageBox.Show(message);
    }

How would i loop through each entry in allaEmail so that i can display it in a MessageBox?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:23:48+00:00Added an answer on June 4, 2026 at 7:23 am

    I can see that you use the fetchAllEmail example from the OpenPop homepage. A similar example showing how to get body text is also on the homepage.

    You might also want to look at how emails are actually structured. A email introduction exists for just this purpose.

    Having that said, I would do something similar to the code below.

    private void button7_Click(object sender, EventArgs e)
    {
        List<OpenPop.Mime.Message> allaEmail = FetchAllMessages(...);
    
        StringBuilder builder = new StringBuilder();
        foreach(OpenPop.Mime.Message message in allaEmail)
        {
             OpenPop.Mime.MessagePart plainText = message.FindFirstPlainTextVersion();
             if(plainText != null)
             {
                 // We found some plaintext!
                 builder.Append(plainText.GetBodyAsText());
             } else
             {
                 // Might include a part holding html instead
                 OpenPop.Mime.MessagePart html = message.FindFirstHtmlVersion();
                 if(html != null)
                 {
                     // We found some html!
                     builder.Append(html.GetBodyAsText());
                 }
             }
        }
        MessageBox.Show(builder.ToString());
    }
    

    I hope this can help you on the way. Notice that there is also online documentation for OpenPop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using open source component to retrieve emails from my mail server using vb.net
Using Yii, I want to delete all the rows that are not from today.
Using C# (the .NET framework), I'm looping through all the TimeZones and their AdjustmentRules...
I am using the OpenPOP library to get Gmail. The issue is that the
I am using OpenPOP I am trying to retrieve mail from an in office
I am using OpenPop.Net to connect to a GoDaddy hosted email account in a
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using Android 2.1+. I have a service that gets killed from time to time
Using the Facebook Javascript API, I am requesting all photos from a certain Facebook
Using the SmtpClient and MailMessage classes in .NET to send emails through a local

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.