tmaususer
asked on
VB.Net Email Issue
Hello experts. I am having an issue with a very simple request form (vb.net) regarding sending an email once the submit button is pressed. My email server is exchange 2010. Here is the issue. Internally in my building the form works great. If I am working remotely I connect to my network using cisco vpn client. My issue is when connected via the cisco vpn client when I attempt to submit the form I get an error email not sent. I thought maybe it had something to do with my exchange server name so I placed my server IP address as well and still the same issue. My code is below if needed. So the question is why does this work internally but not remotely via vpn?
Public Function fnMailer(ByVal strPassEmailTo As String) As Boolean
Dim strError As String = ""
Dim MailMsg As MailMessage = New MailMessage
MailMsg.Subject = "Service Request"
MailMsg.Body = "Generated by system - Please do not reply to message" & vbCrLf & vbCrLf
MailMsg.From = New MailAddress("test@test.com ")
MailMsg.To.Add(strPassEmai lTo)
MailMsg.Body += Global_mailMessage
Dim mailClient As New System.Net.Mail.SmtpClient ("serverna me")
mailClient.UseDefaultCrede ntials = True
Try
mailClient.Send(MailMsg)
Catch ex As SmtpException
MessageBox.Show("Error sending email")
Return False
End Try
Return True
End Function
Public Function fnMailer(ByVal strPassEmailTo As String) As Boolean
Dim strError As String = ""
Dim MailMsg As MailMessage = New MailMessage
MailMsg.Subject = "Service Request"
MailMsg.Body = "Generated by system - Please do not reply to message" & vbCrLf & vbCrLf
MailMsg.From = New MailAddress("test@test.com
MailMsg.To.Add(strPassEmai
MailMsg.Body += Global_mailMessage
Dim mailClient As New System.Net.Mail.SmtpClient
mailClient.UseDefaultCrede
Try
mailClient.Send(MailMsg)
Catch ex As SmtpException
MessageBox.Show("Error sending email")
Return False
End Try
Return True
End Function
what does ex.Message contains in your Catch?
you might also check if http://systemnetmail.com/ has troubleshooting for you
ASKER
All the try catch says is Error sending email. That's what gets displayed.
this is because you force it using this:
Try:
MessageBox.Show("Error sending email")
Try:
MessageBox.Show(ex.Message)
ASKER
Got it. I will change my code and test it to see what error I receive and report back. Thanks.
ASKER
Here is the error
error.JPG
error.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
Checking it out now.
Checking it out now.