Exclamation[Easy][VB2008 Tutorial, Beginner friendly] Sending a Email using SMTP

Posts 1–6 of 6 · Page 1 of 1
[Easy][VB2008 Tutorial, Beginner friendly] Sending a Email using SMTP
== Things Needed ==
Visual Studio/Basics 2008
1 Gmail account (http://gmail.com)
The preformance of not just copy pasting.

== Quick Explenation ==
I got this code from youtube, youtube is also a good source to learn visual bisics these days.
I understand this code if you have some 'simple questions' (not like you gonna test me or whatever if your bored, i mean just real meant qustions) just ask them.

== Start of Tutorial ==

Create a new visual basics project in vb2008.
'File> New Project (ctrl + N)'
select 'Windows Form Application'
Im naming my project 'SMTP Emailer'
Create a label and change the 'text' to 'Subject', screenshot:

Making a label:


Changing label text:


Now create 2TextBoxes

Creating a TextBox:


Select the second TextBox and press the litle black icon and select 'Multi line'

Enabling Multi Line:


Go to TextBox2 Properties (the TextBox we just added multiline too)
Click on the textbox and then look at the right side,
Give Scrolls the value of Vertical.

Giving a TextBox a vertical scroll:


Add a Button, go to the properties and change the text to 'Send'

Adding a button:


Your form should form should look something like this:

1 Label
2 TextBoxes
1 Button

== Next ==
Now double click button1 and add the following code lines:
Code:
Dim MyMailMsg As New MailMessage
        Try
            MyMailMsg.From = New MailAddress("smtplogger@gmail.com")
            MyMailMsg.To.Add("i.aint.on.drugs@gmail.com")
            MyMailMsg.Subject = TextBox1.Text
            MyMailMsg.Body = TextBox2.Text
            Dim SMTP As New SmtpClient("smtp.gmail.com")
            SMTP.Port = 587
            SMTP.EnableSsl = True
            SMTP.Credentials = New System.Net.NetworkCredential("smtplogger@gmail.com", "apenenu12")
            SMTP.Send(MyMailMsg)
            TextBox2.Text = ""
            MsgBox("Your email has been succesfully send, created by Apezwijn", MsgBoxStyle.Information, "Succes!")
        Catch ex As Exception
        End Try
Your not done yet!
Add the top of your code, abouve 'Public Class Form1' add this code line:
Code:
Imports System.Net.Mail
Almost Done!
Go to 'File>Save All (ctrl + shift + s)'
Save it.
Then go 'Build>Build SMTP Emailer'
It says Build SMTP Emailer cos my project name is SMTP Emailer.

Tutorial Created by Apezwijn
Credits: Apezwijn
You have my premission to post this tut anywhere else with my credits.
wat is SMTP en wat is het nut om een email via dat te verzenden? :O
Quote Originally Posted by Dead Bones Brook View Post
wat is SMTP en wat is het nut om een email via dat te verzenden? :O
Talk english on these forums

Translation:
What is SMTP en whats the use to use it to send emails,

Awnser:
SMTP = Simple Mail Transfer Protocol

More info: Simple Mail Transfer Protocol - Wikipedia, the free encyclopedia
Wikipedia
Quote Originally Posted by Dead Bones Brook View Post
wat is SMTP en wat is het nut om een email via dat te verzenden? :O
wow a real nab using dutch in a english forum :@

lol ty for the tut
Nice tut but what would be better is if you explained the parts of the source code a little
Tnx a lot this work very fine!!!

but u need to the explain parts of source code... but nice onde good job!!
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us