Saturday, September 3, 2011

Sending Email using VB.NET Source

Imports System.Net.Mail
    Private Sub
            Dim Mail As New MailMessage
            Mail.Subject = SUBJECT_HERE
            Mail.To.Add("TO_ADDRESS@SOMEDOMAIN.COM")
            Mail.From = New MailAddress("FROM_ADDRESS@SOMEDOMAIN.COM")
            Mail.Body = THE_LONG_BODY_MESSAGE_HERE
            Dim SMTP As New SmtpClient("smtp.gmail.com")
            SMTP.EnableSsl = True
            SMTP.Credentials = New System.Net.NetworkCredential(GmailLoginAddress, GmailPasswordforAddress)
            SMTP.Port = 465
            SMTP.Send(Mail)
    End Sub
This source works with VB .NET only I dont think i should explain how to use it. Learn from the snippets you would be great programmer one day ! :)

0 comments for "Sending Email using VB.NET Source"

Post a Comment

background