A
AZNewsh
System.InvalidOperationException was caught
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail.MailAddress(fromAddy)
Dim toAddress As New System.Net.Mail.MailAddress(toAddy)
Dim msg As New System.Net.Mail.MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail.SmtpClient()
mailSender.Host = "mailgate.nau.edu"
mailSender.Send(msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception?
Message="A from address must be specified."
Public Shared Sub sendEmail(ByVal fromAddy As String, ByVal toAddy As
String, ByVal subject As String, ByVal body As String)
Try
Dim fromAddress As New
System.Net.Mail.MailAddress(fromAddy)
Dim toAddress As New System.Net.Mail.MailAddress(toAddy)
Dim msg As New System.Net.Mail.MailMessage
msg.Subject = subject
msg.Body = body
msg.IsBodyHtml = True
Dim mailSender As New System.Net.Mail.SmtpClient()
mailSender.Host = "mailgate.nau.edu"
mailSender.Send(msg)
Catch ex As Exception
lblError = ex.ToString
End Try
End Sub
I have stepped through line by line and fromAddress does have a value
however I am still gettig the exception?