Search This Blog

Wednesday, October 22, 2008

Sending Email in VB2005

အီးမေး ပို့တဲ့ ပရိုဂရမ်လေးကို VB2005 နဲ့ နမူနာရေးကြည့်ထားတာပါ။ ဒီနမူနာမှာ gmail ကိုသုံးထားတဲ့အတွက် စမ်းကြည့်ဖို့အတွက် gmail account တစ်ခုတော့လိုပါလိမ့်မယ်။

Imports System.Net.Mail Public Sub SendMail() Dim mail As New MailMessage() 'set the addresses mail.From = New MailAddress("") mail.To.Add("") 'set the content mail.Subject = "Sample Subject" mail.Body = "This is a body" 'send the message Dim smtp As New SmtpClient("", 587) smtp.Credentials = New System.Net.NetworkCredential("", "yourpassword") smtp.EnableSsl = True Try smtp.Send(mail) Catch ex As Exception MsgBox(ex.ToString()) End Try End Sub

No comments:

Post a Comment