Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to send e-mail from VB .NET program

Status
Not open for further replies.

Sielah

Programmer
Oct 9, 2007
50
0
0
CA
I'm trying to add an e-mail send utility to my VB program, but not having much luck.

I'm using Visual Studio 2005, and I have added Imports System.Net.Mail to the module.

Here's my code :

Dim objSmtpClient As SmtpClient
Dim objMailMessage As MailMessage
Dim objMailAddress As MailAddress

objSmtpClient = New SmtpClient
objMailAddress = New MailAddress("myname@mycompany.com")
objMailMessage = New MailMessage(objMailAddress, objMailAddress)

objMailMessage.Subject = "test"
objMailMessage.Body = "test"

objSmtpClient.Host = "<smtp host name>"
objSmtpClient.Port = 25

Call objSmtpClient.Send(objMailMessage)

The Send method fails with the following error :

{"Unable to connect to the remote server"}
{"No connection could be made because the target machine actively refused it"}

I verified the SMTP host settings with our mail server specialist. He told me that it should not be necessary to use credentials when sending e-mails internally, as our servers allow anonymous requests.

Anybody have any advice on why the send method is failing?
 

Make sure your email server doesn't require some form of authentication, such as SSL or TLS. This has burned me in the past, even with anonymous connections.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
I followed up with our e-mail server expert, and he advised that the problem was probably being caused by our AV software.

I asked our AV admin team to add my computer to the policy exclusion list, and was then able to generate e-mail requests.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top