hi folks...
This is a easy way to send a mail using vb coding...its very simple try this code & send you first email through vb.net
First you have to import the namespace for send the mail
system.net.mail
Dim log As String = " "
Dim content As String = "This is my first mail using asp.net"
Dim mail As MailMessage = New MailMessage()
mail.To.Add("add sender email address")
mail.From = New MailAddress(" your email address")
mail.Subject = "Email using Gmail"
mail.Body = content
mail.IsBodyHtml = True
Dim smtp As SmtpClient = New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.Credentials = New System.Net.NetworkCredential("your gmail username", " gmail password")
smtp.EnableSsl = True
Label1.Text = "your mail has sent"
Try
smtp.Send(mail)
Catch ex As Exception
Label1.Text = "The email cannot be sent" + ex.ToString()
End Try
0 comments:
Post a Comment