1

I'm getting the following error for a specific email using a POP3 server:

Rebex.Net.Pop3Exception: The specified message is out of range.

When using:

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
Bugs
  • 4,491
  • 9
  • 32
  • 41
Wesam
  • 932
  • 3
  • 15
  • 27
  • Apparently you aren't passing a valid `SequenceNumber` parameter so look into how you got that number. – topshot Jul 14 '16 at 13:20
  • Actually no am passing it correctly , thanks for the note i added how i get the sequence number to my code snippet – Wesam Jul 14 '16 at 14:27

1 Answers1

0

You never set Message to anything so SequenceNumber would be nothing or maybe 0. From their example at 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

Once you set Message as they did list, you would have access to the SequenceNumber property of each item in the list as they show in the For Each loop.

topshot
  • 885
  • 6
  • 21
  • message is being passed as a parameter(in my method not included in this snippet ) it is filled i assure you if it was the case the error would be sequence contains no element , anyway thanks for the effort . – Wesam Jul 17 '16 at 07:10