指定的消息超出范围错误

时间:2016-07-14 10:25:31

标签: vb.net ftp dbcontext rebex

对于使用POP3服务器的特定电子邮件,我收到以下错误:

  

Rebex.Net.Pop3Exception:指定的消息超出范围。

使用时:

Dim SequenceNumber As Integer = 0
Dim MailMsg As Rebex.Mail.MailMessage = Nothing
Dim UTF8 As New Text.UTF8Encoding
Dim RebexPop3 as new rebex.Net.Pop3
Dim Message As Rebex.Net.Pop3MessageCollection

SequenceNumber = Message.SequenceNumber 
MailMsg = RebexPop3.GetMailMessage(SequenceNumber)
MailMsg.DefaultCharset = UTF8 ' Error generated when filling UTF8

1 个答案:

答案 0 :(得分:0)

您永远不会将Message设置为任何内容,因此SequenceNumber将无效或可能为0. {来自http://www.rebex.net/secure-mail.net/features/pop3.aspx的示例

' get list of all messages
Dim list As Pop3MessageCollection = pop3.GetMessageList(Pop3ListFields.Fast)

' print some info
Console.WriteLine("Found {0} message(s).", list.Count)
For Each info In list
    Console.WriteLine("{0}: {1} [{2}]", info.SequenceNumber, info.UniqueId, info.Length)
Next

按照Message设置list后,您可以访问列表中每个项目的SequenceNumber属性,因为它们显示在For Each循环中。