sendmail hangs when I declare an api function

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

I have a simple mailsys solution that works splendidly.

I decided to add a listview with file association icons to replace a listbox
that displays the full path only of an attachment. But when I add this
(which I need to get the file association icons):
Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (ByVal pszPath
As String, ByVal dwFileAttributes As Integer, ByRef psfi As SHFILEINFO,
ByVal cbFileInfo As Integer, ByVal uFlags As Integer) As IntPtr

The system now runs but hangs once I call sendmail. Without this call in
the declarations section above the load event, the system works fine. Any
ideas why just having a call like this in the declarations section would
hang up sendmail?

Thanks for any help.

Bernie Yaeger
 
OK, I have found out a little more: the hang is in a try catch block:
Try

SmtpMail.Send(msg)

sendcount += 1

Catch ex As Exception

xcount += 1

MessageBox.Show("Mail send error; please check the 'from' address and/or the
SMTP Server settings.", "Send Error", MessageBoxButtons.OK,
MessageBoxIcon.Hand)

End Try

If I remove try..catch..endtry and simply call smtpmail.send(msg) it works
fine. Any ideas?

Bernie
 
Back
Top