Categories
Sending email via ASP.NET (Visual Basic)
Herewith an example to send an email via asp.net Visual basic in combination with smtp authentication:
Dim Message As MailMessage = New MailMessage(
)Dim Smtp As New SmtpClient()
Dim SmtpUser As New System.Net.NetworkCredential()
'-- Basic data emailMessage
.From = New MailAddress("van@email.nl", "From example")
Message.To.Add(New MailAddress("naar@email.nl", "To example"))
Message.IsBodyHtml = False
'-- Subject Data & BodyMessage
.Subject = "Subject title "
Message.Body = "Sample text body"
'-- SMTP Authentication, an email address created in the control panelSmtpUser
.UserName = "email address "
SmtpUser.Password = "password to the email address"
'-- Send MessageSmtp
.UseDefaultCredentials = FalseSmtp
.Credentials = SmtpUserSmtp
.Host = "smtp.myhostingpartner.com "
Smtp.DeliveryMethod = SmtpDeliveryMethod.NetworkSmtp
.Send(Message)