如何使用 pop3 检索未读电子邮件?
我正在使用开源组件使用 vb.net (pop3) 从我的邮件服务器检索电子邮件 但因为我有很多消息,它给了我响应超时,我想如果我刚刚收到新消息,它会让阅读速度更快。 这是我的代码:
Dim popp As New Pop3Client("[email protected]", "*******", "pop3.mail.com")
popp.AuthenticateMode = Pop3AuthenticateMode.Pop
popp.Port = 110
'popp.Ssl = True
popp.Authenticate()
Dim msglist As New List(Of String)
If popp.State = Pop3ConnectionState.Authenticated Then
Dim totalmsgs As Integer = popp.GetTotalMessageCount()
If totalmsgs > 0 Then
For index As Integer = 1 To totalmsgs
Dim msg As Pop3Message = popp.GetMessage(index)
msglist.Add(msg.Subject)
Next
popp.Close()
End If
End If
Return msglist
如果我以错误的方式使用该组件,或者如果有另一个组件执行我正在寻找的操作,请我需要一些帮助。 bs :我的组件名称是“Higuchi.Mail.dll”或“OpenPOP.dll”,两者是相同的。
谢谢
I'm using open source component to retrieve emails from my mail server using vb.net (pop3)
but because i have a lot of messages it gives me response Time out and i think if i just got the new messages it will make reading faster.
this is my code:
Dim popp As New Pop3Client("[email protected]", "*******", "pop3.mail.com")
popp.AuthenticateMode = Pop3AuthenticateMode.Pop
popp.Port = 110
'popp.Ssl = True
popp.Authenticate()
Dim msglist As New List(Of String)
If popp.State = Pop3ConnectionState.Authenticated Then
Dim totalmsgs As Integer = popp.GetTotalMessageCount()
If totalmsgs > 0 Then
For index As Integer = 1 To totalmsgs
Dim msg As Pop3Message = popp.GetMessage(index)
msglist.Add(msg.Subject)
Next
popp.Close()
End If
End If
Return msglist
please i need some help if i'm using the component in a wrong way or if there is another component do what i'm looking for.
b.s. : my component name is "Higuchi.Mail.dll" or "OpenPOP.dll" and the two are same.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
POP3 无法跟踪邮件是否已读或未读。我建议您将限制设置为有限数量,例如 50 或 100。也许您可以使用某种分页系统。
此代码需要位于函数内,以便您可以像这样调用它:
只需让程序将
startItem
的值更改为 50 即可获得下一个 50 个项目(项目 50-100)POP3 does not have the capibility to track whether messages are read or unread. I would suggest you set your limit to a finite number such as 50 or 100. Perhaps you could do some sort of pagination system.
This code needs to be within a function so that you can call it like so:
Just have the program change the value for
startItem
to 50 get the next fifty (items 50-100)POP3 协议没有已见/未见消息的概念。
您不能使用IMAP吗?
它将为您提供比 POP3 更多的功能(如搜索、标记、文件夹管理)。
POP3 protocol does not have the notion of seen/unseen messages.
Can't you use IMAP?
It would give you more features (like searching, flagging, folder management) than POP3.