Your technology certification is waiting. Enroll in Cloud Class ®
Dim Message As MailMessage = New MailMessage()
Dim Smtp As New SmtpClient()
Dim SmtpUser As New System.Net.NetworkCredential()
'-- Build Message
Message.From = New MailAddress("someUsername@myemailserver.com", "Some Username")
Message.To.Add(New MailAddress("someRecipient@theirDomain.com", "Some Recipient"))
Message.IsBodyHtml = False
Message.Subject = "Sending mail is fun."
Message.Body = "Mail sent from application"
'-- Define Authenticated User
SmtpUser.UserName = "someUsername"
SmtpUser.Password = "somePassword"
SmtpUser.Domain = "mail.myemailserver.com"
'-- Send Message
Smtp.UseDefaultCredentials = False
Smtp.Credentials = SmtpUser
Smtp.Host = "mail.mailemailserver.com"
Smtp.DeliveryMethod = SmtpDeliveryMethod.Network
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.