Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim Mail As New MailMessage
Mail.Subject = "Test email"
Mail.To.Add("alorashif@gmail.com")
Mail.From = New MailAddress("alorashif@gmail.com")
Mail.Body = "to test sending mail from vb.net"
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("alorashif@gmail.com", "989551542b")
SMTP.Port = "587"
SMTP.Send(Mail)
Catch error_t As Exception
MsgBox(error_t.ToString)
End Try
Shifas 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.