I have built a windows service that sends mail from a database table using smtp. This worked fine until we moved to a new ISP. This ISP requires simple smtp authentication. I built this into my service. But still I get problems. I discussed with the ISP
what could be the problem, eventually I got it to work using telnet. On my own program though, it still doesn't work. I get the following error:
Error: Mailbox unavailable. The server response was: 5.7.1 <email@example.com>... Relaying denied. Proper authentication required.
The code I use to send mail:
Dim MailMsg As New MailMessage(New MailAddress("firstname.lastname@example.org"), New MailAddress("email@example.com"))
MailMsg.BodyEncoding = Encoding.Default
MailMsg.Subject = "Onderwerp"
MailMsg.Body = "Mailbody"
MailMsg.Priority = MailPriority.Normal
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = My.Settings.SMTPServer
If My.Settings.SMTPUser.Length > 0 Then
Dim basicAuthenticationInfo As New System.Net.NetworkCredential(My.Settings.SMTPUser, My.Settings.SMTPPass)
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = basicAuthenticationInfo
View Complete Post