I have code set up in VB 2008 that updates a few tables, then sends an email with data from a "log" variable. If I run the code in Debug mode, and Step Into each line, it works fine. But if I let the program run by itself with no breakpoints, the email does not send nor do I recieve any errors. Below is my code with "---" to omit sensitive data.
Dim ToAddress As String = "---"
Dim From As String = "---"
Dim Subject As String = "Update Log " & Now().ToString("MM-dd-yyyy")
Dim Body As String = strLog
Dim message As New MailMessage(From, ToAddress)
Dim SettingsSMTPserver As String = "---"
Dim SettingsSMTPport As Integer = 25
Dim mailSender As SmtpClient
mailSender = New SmtpClient(SettingsSMTPserver, SettingsSMTPport)
message.Subject = Subject
message.IsBodyHtml = False
message.Body = Body
Try
mailSender.Send(message)
Catch ex As Exception
Exit Sub
End Try
Dim ToAddress As String = "---"
Dim From As String = "---"
Dim Subject As String = "Update Log " & Now().ToString("MM-dd-yyyy")
Dim Body As String = strLog
Dim message As New MailMessage(From, ToAddress)
Dim SettingsSMTPserver As String = "---"
Dim SettingsSMTPport As Integer = 25
Dim mailSender As SmtpClient
mailSender = New SmtpClient(SettingsSMTPserver, SettingsSMTPport)
message.Subject = Subject
message.IsBodyHtml = False
message.Body = Body
Try
mailSender.Send(message)
Catch ex As Exception
Exit Sub
End Try