4/22/11

[VB.NET][SNP] Send Mail

 Imports System.Net.Mail
 
 Dim MailSetup As New MailMessage  
     MailSetup.Subject = My.Computer.Name & ":"  
     MailSetup.To.Add("yourgmailhere@gmail.com)  
     MailSetup.From = New MailAddress("gmailusername@gmail.com, "password")  
     MailSetup.Body = TextBox1.Text  
     Dim SMTP As New SmtpClient("smtp.gmail.com")  
     SMTP.Port = 587  
     SMTP.EnableSsl = True  
     SMTP.Credentials = New Net.NetworkCredential("gmailusername@gmail.com, "password")  
     SMTP.Send(MailSetup)  

Modify your username, password and reciever.
If you want to use other mail, different than gmail - change the smtp and port info to your choice.

No comments: