---------------------------------------------------
Imports System.Net.Mail Public Sub SendMail() Dim mail As New MailMessage() 'set the addresses mail.From = New MailAddress("yourname@gmail.com") mail.To.Add("DestinationAddress@gmail.com") 'set the content mail.Subject = "Sample Subject" mail.Body = "This is a body" 'send the message Dim smtp As New SmtpClient("smtp.gmail.com", 587) smtp.Credentials = New System.Net.NetworkCredential("yourname@gmail.com", "yourpassword") smtp.EnableSsl = True Try smtp.Send(mail) Catch ex As Exception MsgBox(ex.ToString()) End Try End Sub
---------------------------------------------------
Wednesday, October 22, 2008
Sending Email in VB2005
Here is an example code to send email using VB2005. We have used gmail to illustrate it and you need to have a gmail account to test it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Comments are moderated and don't be surprised if your comment does not appear promptly.