24-Sending an Email


This Visual Basic Tutorial is all about Sending an Email.
In Visual Basic, sending e-mails are allowed in your application. The System.Net.Mail is the namespace that contains classes  that is used for sending e-mails to a Simple Mail Transfer Protocol (SMTP) server for delivery.

The SmtpClient class allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP).

Take note that in sending e-mail you must specify the SMTP host server because the Host and Port properties will be different for various host server.

In here, we will be using Gmail server.

If the STMP server requires you for the authentication, you must need to give the Credentials


Sender’s email address should be provided same as the recipients using the MailMessage.From and MailMessage.To properties. Specify  also the content of message by using MailMessage.Body property.



  1. Open the Visual Basic, select “File” on the menu, hit new and create a new project.
  2. The New Project dialog will appear.
    Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
  3. Design the form this way. See it Below.
  4. dd the following code in the code editor.



Readers might read also:




Looking for more source code? Type your keyword here here!


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.