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!

Net.Mail fails when sending outside local network.

Status
Not open for further replies.

AnotherJob

Programmer
Jun 13, 2007
25
0
0
US
I've inherited responsibility for an email notification program written in Visual Basic .Net. The program generally works fine for sending emails within our business organization, but it fails when trying to send notifications out to our vendors, outside of our business network. It gives the following message:

"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Relaying not allowed."

Our network support specialists say the failure is because our SMTP server requires TLS protocol. The VB code is using System.Net.Mail, and I believe that setting EnableSsl=True should also take care of TLS, but I'm not able to convince our specialists.

Can anyone here share insight into how to solve this problem? A sketch of the VB code is below:


Imports System.Net.Mail

Dim SMTP As New SmtpClient
SMTP.Host = SMTP_HOST
SMTP.Port = SMTP_PORT
SMTP.EnableSsl = SMTP_SSL
SMTP.UseDefaultCredentials = False
SMTP.Credentials = New System.Net.NetworkCredential(SMTP_USER, SMTP_PWD)

Dim Mail As New MailMessage
Mail.IsBodyHtml = True
Mail.From = New MailAddress(SMTP_FROM)
Mail.Subject = EMAIL_SUBJECT
Mail.Body = EMAIL_BODY
Mail.To.Add(EMAIL_LIST)

SMTP.Send(Mail)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top