How to send email from your code?

' Visual Basic Sample - Sending SMTP Authenticated E-mail

' Please replace in code with your domain hosted with us
Private Sub SendEmail()
' Create a new MailMessage object and specify the "From" and "To" addresses
Dim message As New MailMessage("From email", "To Email", "Subject", "Body message")
Dim emailClient As New SmtpClient("")
' Authentication
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("", "Password")
emailClient.UseDefaultCredentials = False
emailClient.Credentials = basicAuthenticationInfo
message.IsBodyHtml = True
Catch ex As Exception
MessageBox.Show("Error sending email: " + ControlChars.NewLine _
+ ControlChars.NewLine + ex.Message)
End Try
End Sub






<network host="" port="8889" userName="" password="password" />




Was this answer helpful?

 Print this Article

Also Read

Conection String to MS SQL 2008 DB - example

In order to connect to SQL Server 2008 from Management Studio, Enterprise Manager, Query...

How to configure web deploy/ webmatrix?

How to configure Web deploy & Webmatrix in WebsitePanel First log in WebsitePanel, navigate...

I get Error reading web site information when i click my website in Websitepanel

A) this usually means that eithera) you have deleted wwwroot/web.configb) edited...