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(strPassEmailTo)

        MailMsg.Body += Global_mailMessage
        Dim mailClient As New System.Net.Mail.SmtpClient("servername")

        mailClient.UseDefaultCredentials = True

        Try
            mailClient.Send(MailMsg)
        Catch ex As SmtpException
            MessageBox.Show("Error sending email")
            Return False
        End Try

        Return True

    End Function
tmaususerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
what does ex.Message contains in your Catch?
0
Éric MoreauSenior .Net ConsultantCommented:
you might also check if http://systemnetmail.com/ has troubleshooting for you
0
tmaususerAuthor Commented:
All the try catch says is Error sending email. That's what gets displayed.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Éric MoreauSenior .Net ConsultantCommented:
this is because you force it using this:
MessageBox.Show("Error sending email")

Open in new window


Try:
MessageBox.Show(ex.Message)

Open in new window

0
tmaususerAuthor Commented:
Got it. I will change my code and test it to see what error I receive and report back. Thanks.
0
tmaususerAuthor Commented:
Here is the error
error.JPG
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmaususerAuthor Commented:
Thanks,

Checking it out now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.