views:

79

answers:

0

Hi

Im using the chilkat component Available Here to display the subject and sender of the email in a listbox.Is there a way that when a user clicks the subject of the message in the list box that the body will display in a texbox below.

Thanks in advance

Code so far

 // Set the GMail account POP3 properties.
        mailman.MailHost = "pop.gmail.com";
        mailman.PopUsername = "**********";
        mailman.PopPassword = "**********";
        mailman.PopSsl = true;
        mailman.MailPort = 995;

        Chilkat.EmailBundle bundle;
        // Read mail headers and one line of the body.
        // To get the full emails, call CopyMail instead (no arguments)
        bundle = mailman.GetEmail(1);

        if (bundle == null)
        {
            MessageBox.Show(mailman.LastErrorText);
            return;
        }

        int i;
        Chilkat.Email email;
        for (i = 0; i <= bundle.MessageCount - 1; i++)
        {
            email = bundle.GetEmail(i);

            // Display the From email address and the subject.
             listBox1.Items.Add( email.From + "\r\n");
             listBox1.Refresh();
             listBox2.Items.Add( email.Subject + "\r\n" + "\r\n");
             listBox2.Refresh();
             textBox1.Text += email.Body + "\r\n" + "\r\n";


        }


    }
}