GSendMail

GSendMail is a function which allows you to send mails from your Given G-Mail account.
It’s simple to use I’m tired to explain how to use it and if you don’t understand the code go learn the basics first.

Imports System.Net.Mail
Module mSendMail

Public Sub GSendMail(ByVal MyEmail As String, ByVal ToMail As String, ByVal TheSubject As String, ByVal MainText As String, ByVal Username As String, ByVal Password As String)
Dim MyMailMessage As New MailMessage()
MyMailMessage.From = New MailAddress(MyEmail)
MyMailMessage.To.Add(ToMail)
MyMailMessage.Subject = (TheSubject)
MyMailMessage.Body = (MainText)

Dim SMTPServer As New SmtpClient(“smtp.gmail.com”)
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential(Username, Password)
SMTPServer.EnableSsl = True
SMTPServer.Send(MyMailMessage)
End Sub

End Module

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s