Many web hosting now require sender authentication when sending e-mail through a relay server. These mail servers have their security locked down. Sometimes, localhost is an available SMTP server option, but if a relay server is required, a little extra code is also required.
ASP.Net offers the NetworkCredential class for this purposes. By setting the NetworkCredential property in the SMTPClient object with the appropriate credentials, authentication can be passed with the request. For example:
Dim smtp As New Net.Mail.SmtpClient
Dim m As New Net.Mail.MailMessage
m.Subject = "the subject"
m.From = New Net.Mail.MailAddress("email@domainname.com")
m.To.Add("john@demtron.com")
Dim Auth As New System.Net.NetworkCredential("email@domainname.com", "password")
smtp.UseDefaultCredentials = False
smtp.Credentials = Auth
smtp.Host = "smtp.domainname.com"
smtp.Send(m)