我使用chilkat组件Available Here在列表框中显示电子邮件的主题和发件人。有一种方法,当用户点击列表框中邮件的主题时,正文将显示在下面的texbox。
提前致谢
到目前为止代码
// 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";
}
}
}