M
m Harvey
I have a windows service that calls a function in the Timer1_elapsed
event. When I attach to the process to debug and step through the code,
it gets to the function call and never steps into the function, but
rahter acts like it doesn't exist. It also seems that no statements are
executed after this as it seems to run until it gets back to the
original breakpoint. Any one have any idea why this would die? It works
great in a regular executable, but I need it to work in a windows
service. The function calls the Mail.dll available at:
http://lesnikowski.fm.interia.pl/
I call the function with:
mailran = GetMail("some mail host here", "username", "password", "save
attachments path here")
and the function itself is:
Imports Lesnikowski.Mail
Public Function Snagmail(ByVal host As String, ByVal username As String,
ByVal password As String, ByVal savetofolder As String) As Boolean
Dim pop3 As New Lesnikowski.Client.Pop3
pop3.User = username
Dim i As Integer
Dim blnClearCache As Boolean = False
pop3.Password = password
pop3.Connect(host)
pop3.Login()
pop3.GetAccountStat()
If pop3.MessageCount > 0 Then
For i = 1 To pop3.MessageCount
Dim mailMessage As SimpleMailMessage =
SimpleMailMessage.Parse(pop3.GetMessage(i))
If mailMessage.Attachments.Count > 0 Then
Dim MimeDataList As New Lesnikowski.Mail.MimeDataList
MimeDataList = mailMessage.Attachments
Dim mimedata As Lesnikowski.Mail.MimeData
blnClearCache = True
For Each mimedata In MimeDataList
mimedata.Save(savetofolder & mimedata.FileName)
Next
End If
Next
For i = 1 To pop3.MessageCount
pop3.DeleteMessage(i)
Next
End If
pop3.Close()
Exit Function
End Function
event. When I attach to the process to debug and step through the code,
it gets to the function call and never steps into the function, but
rahter acts like it doesn't exist. It also seems that no statements are
executed after this as it seems to run until it gets back to the
original breakpoint. Any one have any idea why this would die? It works
great in a regular executable, but I need it to work in a windows
service. The function calls the Mail.dll available at:
http://lesnikowski.fm.interia.pl/
I call the function with:
mailran = GetMail("some mail host here", "username", "password", "save
attachments path here")
and the function itself is:
Imports Lesnikowski.Mail
Public Function Snagmail(ByVal host As String, ByVal username As String,
ByVal password As String, ByVal savetofolder As String) As Boolean
Dim pop3 As New Lesnikowski.Client.Pop3
pop3.User = username
Dim i As Integer
Dim blnClearCache As Boolean = False
pop3.Password = password
pop3.Connect(host)
pop3.Login()
pop3.GetAccountStat()
If pop3.MessageCount > 0 Then
For i = 1 To pop3.MessageCount
Dim mailMessage As SimpleMailMessage =
SimpleMailMessage.Parse(pop3.GetMessage(i))
If mailMessage.Attachments.Count > 0 Then
Dim MimeDataList As New Lesnikowski.Mail.MimeDataList
MimeDataList = mailMessage.Attachments
Dim mimedata As Lesnikowski.Mail.MimeData
blnClearCache = True
For Each mimedata In MimeDataList
mimedata.Save(savetofolder & mimedata.FileName)
Next
End If
Next
For i = 1 To pop3.MessageCount
pop3.DeleteMessage(i)
Next
End If
pop3.Close()
Exit Function
End Function