Searching POP3 accounts for bounced emails with vb.net

3. Code our method to load our POP3 file

Below you is my method to handle this.  Since I documented it pretty well, I do not see the point in explaining each step:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
''' This will load all of our pop3's into an array of username:password
'''
'''
'''
Private Function Load_POP3(file As String)
 
  'Make sure file exists
  If IO.File.Exists(file) = False Then Return False
 
  'Open the file for reading, using a catch statement incase the file is locked
  Try
 
  Dim reader As New IO.StreamReader(file)
 
  'Loop reading from the reader while we still have data
  While reader.Peek > 0
 
    'Get the next line from the reader file
    Dim line As String = reader.ReadLine
 
    'Split up the line by VBTab making sure there is 4 fields
    Dim secs() As String = Split(line, vbTab)
    If secs.Count <> 4 Then Continue While
 
    'Since we have all of the sections needed, make sure the final part is a number (port)
    If IsNumeric(secs(3)) = False Then Continue While
 
    'Add this specific account to the list
    Dim current As New Account With {.username = secs(0), .password = secs(1), .server = secs(2), .port = CLng(secs(3))}
 
    'Add this account to our list of accounts
    accounts.Add(current)
 
  End While
 
  'If we have an error, file must be locked so return false
  Catch ex As Exception
    Return False
  End Try
 
  'Return true since we are done
  Return True
 
End Function
Pages:
  1. very nice website, enjoy the way you write, you definitely do hold a flair for writing, will be viewing this website quite often

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">