如何使用POP3检索未读电子邮件 [英] How to retrive unread emails using POP3
本文介绍了如何使用POP3检索未读电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好您好
请告诉我如何使用POP3回复未读电子邮件。
我正在使用SSL 995 port pop.gmail.com和正确的用户名和密码
但是因服务器不接受用户凭据而给出错误
我正在使用来自sourge fprce的OpenPop.dll
http://sourceforge.net/projects/hpop/?source=directory [ ^ ]
推荐答案
如何使用pop3检索未读的电子邮件
how to retrieve just unread emails using pop3
public void Main()
{
int start = int.parse(Request.QueryString("start"));
int count = int.parse(Request.QueryString("count"));
List<string> subjects = new List<string>();
subjects = getSubjects(start, count);
//Do whatever with the results...
//
}
public List<string> getSubjects(int startItem, int endItem)
{
Pop3Client popp = new Pop3Client("user@mail.com", "*******", "pop3.mail.com");
popp.AuthenticateMode = Pop3AuthenticateMode.Pop;
popp.Port = 110;
popp.Authenticate();
List<string> msglist = new List<string>();
if (popp.State == Pop3ConnectionState.Authenticated) {
int totalmsgs = popp.GetTotalMessageCount();
int endItem = countItems + startItem;
if (endItem > totalmsgs) {
endItem = totalmsgs;
}
if (totalmsgs > 0) {
for (int index = startItem; index <= endItem; index++) {
Pop3Message msg = popp.GetMessage(index);
msglist.Add(msg.Subject);
}
popp.Close();
}
}
return msglist;
}
这篇关于如何使用POP3检索未读电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文