We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Emailing from VB.NET APP

hendrix500 asked
Medium Priority
Last Modified: 2010-04-17
Hi everyone.

I have a problem sending emails from my vb.net program. It is fine sending to email address's on our domain, but doesn't work if I try and send to an external address e.g. hotmail account. No error is reported, the email is just never recieved.

Code is as follows:

Dim Message As New System.Web.Mail.MailMessage
With Message
    .To = "<myexternaladdress@hotmail.co.uk>"
    .From = "<myapp@mydomain.co.uk>"
     .Body = "My test mail"
     .Subject = "My subject"
End With

Dim MailServer As System.Web.Mail.SmtpMail
MailServer.SmtpServer = "555.555.555.5"   'IP of my exchange server (version 5.5 sp2)

Any help would be great

Watch Question

Check the SMTP server logs on:

>>>MailServer.SmtpServer = "555.555.555.5"

I suspect that for some reason it is configured NOT to permit relaying of email from your web server to the outside world.  The logs should show the problem.

Also, are you sure there is no error?  How about checking for an error in your VB.NET code?  SmtpMail throws a System.Web.HttpException.  You don't seem to be catching that exception.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Senior .Net Consultant
Top Expert 2016
Hi hendrix500,

> It is fine sending to email address's on our domain, but doesn't work
> if I try and send to an external address

Your sysadmin had stopped relay. They all do that because of spamming. You should have him install a SMTP server that is not available from the outside (but will be able to send e-mails outside).



Thanks for your help


Both answers were correct. I awarded slighlty in favour of emoreau because of the suggestion to install a SMTP server.

Thanks alot to both
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.