jhylands

Email

Jan 3rd, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.57 KB | None | 0 0
  1. public sub SendEmail(byval Body as string,byval Subject as string, byval TO as string, byval FROM as string, byval SenderPassword as string, byval SenderCliant as string = "smtp.gmail.com")
  2.         Dim Mail As New MailMessage
  3.         Mail.Subject = Subject
  4.         Mail.To.Add(TO)
  5.         Mail.From = New MailAddress(FROM)
  6.         Mail.Body = Body
  7.         Dim SMTP As New SmtpClient(SenderCliant)
  8.         SMTP.EnableSsl = True
  9.         SMTP.Credentials = New System.Net.NetworkCredential(FROM, SenderPassword)
  10.         SMTP.Port = "587"
  11.         SMTP.Send(Mail)
  12. End Function
Advertisement
Add Comment
Please, Sign In to add comment