获取电子邮件正文 C# .net
我使用 chilkat 组件此处可用在列表框中显示电子邮件的主题和发件人。有没有一种方法,当用户单击列表框中的消息主题时,正文将显示在下面的文本框中。
预先感谢
到目前为止的代码
// 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";
}
}
}
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";
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论