25. Emailing Application
In the previous tutorial, we covered sending an email by connecting to an SMTP server using VB.NET. In this tutorial, we will create a Graphical User Interface for the user.
Code
Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Mail As New MailMessage Mail.Subject = "test email" Mail.To.Add(TextBox2.Text) Mail.From = New MailAddress(TextBox2.Text) Mail.Body = TextBox1.Text Dim SMTP As New SmtpClient("smtp.gmail.com") SMTP.EnableSsl = True SMTP.Credentials = New System.Net.NetworkCredential(TextBox2.Text, TextBox3.Text) SMTP.Port = "587" SMTP.Send(Mail) End Sub End Class

