DIR Return Create A Forum - Home
---------------------------------------------------------
3xtGamingCoding
HTML https://3xtgamingcoding.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Visual Basic
*****************************************************
#Post#: 11--------------------------------------------------
[Tutorial] Email Sender
DIR By: akimo360
Date: November 25, 2011, 2:15 pm
---------------------------------------------------------
This tutorial will guide and show you how to make your very own
email sending program. We hope you enjoy this tutorial and our
future tutorials. Invite you friends who want to learn how to
code to this website for more tutorials, game play, and
releases. Now time for the tutorial, Enjoy!!!
For this tutorial, these are the required items:
- 1 Button(Send)
- 5 TextBoxes(Recipient, Email, Password, Title, Contents)
Step 1.
Import This Code Before Public Class Form1. What this is doing
is importing the required namespace so it can recognize the
method we are using.
--- Code ---
Imports System.Net.Mail
--- End Code ---
Step 2.
Put this code in Button1. This declares a new mail message, sets
the title, email, and the message.
--- Code ---
Dim Mail As New MailMessage
Mail.Subject = TextBox3.Text
Mail.To.Add(TextBox3.Text)
Mail.From = New MailAddress(TextBox3.Text)
Mail.Body = TextBox5.Text
--- End Code ---
Step 3. Put this right under the previous code. This configures
the email you will use to send the message above, then sends it.
--- Code ---
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 Code ---
And there you go your very own email sender. We Hope you enjoy
and comeback soon for more tutorials.
*****************************************************
Page 1 of 1