AnotherJob
Programmer
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)
"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)