Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here my code:Please help

C#
        pop3Client.Disconnect();
    pop3Client.Connect(txtMailServer.Text, int.Parse(txtPort.Text), chkSSL.Checked);
    pop3Client.Authenticate(txtUserName.Text, txtPassword.Text);
    int count = pop3Client.GetMessageCount();
    MessageBox.Show(this, "Loggedin");


     DataSet dataSet = new DataSet();
     DataTable table = dataSet.Tables.Add("Headers");
    table.Columns.Add("From");
    table.Columns.Add("Subject");
    table.Columns.Add("Date");
    DataRowCollection rows = table.Rows;

    var uids = pop3Client.GetMessageUids();

    Message message;

   int counter =0;
  for (int i = count; i >= 1; i--)
   {

        // Check if the form is closed while we are working. If so, abort
        if (IsDisposed)
        return;

        // Refresh the form while fetching emails

        Application.DoEvents();

       message = pop3Client.GetMessage(i);



        rows.Add();
        rows[table.Rows.Count - 1]["From"] = message.Headers.From.Address;
       rows[table.Rows.Count - 1]["Subject"] = message.Headers.Subject;
       rows[table.Rows.Count - 1]["DateSent"] = message.Headers.DateSent;

       counter++;
    }


       // gvEmails.AutoGenerateColumns = true;
       gvEmails.DataMember = table.TableName;
       gvEmails.DataSource = dataSet;
       gvEmails.DataSource = table;


}
Posted
Updated 4-May-15 19:20pm
v2
Comments
[no name] 5-May-15 1:22am    
What is the problem that you are facing

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900