Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TUT] How to make a program that send emails [VB.Net]
#1
Now this is my first tutorial for VB.Net so i hope it is set out well and you like. I couldn't find this on the forum and im sorry if this is already posted.

Well in this tutorial we are going to learn how to make a Visual Basic 2008 Program that sends an email.

First, if you havent already install Visual Basic 2008 express edtion.
1. Launch VB2008 and your screen should look like the picture below.
Now, just select "Create Project" Then "Windows Form Application" , enter a name and hit OK.

[Image: vbtutemailapp1.png]

If everything went correct your page should look like the one below. Just click properties and follow the next steps.

[Image: vbtutemailapp2.png]

I will explain what to do for this bit in text, if you have any problems then request a picture.

First change the "Text" to 'Emailer' and click out of the box to finalize it. Know its best to get into the habit of changing the name of the form, but for this quick tut i wont bother.

Once that's done, add 5 labels, 5 textboxes and 1 button. Arrange everything to look like this. Now i am hopping you know how to change the text of a file from before, but if you don't, then just right click on the button or textbox and click properties. Now scroll down and find text and enter in what i have.

[Image: vbtutemailapp3.png]

Now, this is just the GUI that is done, it is now time for code. First thing we do is Imports systems.net.mail.You can do this by double-clicking the word "Emailer", You should see just a big blank white bit, thats good. Now all you have to do is copy this code in.
Code:
Imports System.Net.Mail
Your screen should now loo like the one below.

[Image: vbtutemailapp4.png]

Now go click form1design tab and Double-click The send button and paste this code in
Code:
Dim MyMailMessage As New MailMessage()
        MyMailMessage.From = New MailAddress(TextBox1.Text)
        MyMailMessage.To.Add(TextBox3.Text)
        MyMailMessage.Subject = (TextBox4.Text)
        MyMailMessage.Body = TextBox5.Text
        Dim SMTPServer As New SmtpClient("smtp.gmail.com")
        SMTPServer.Port = 587
        SMTPServer.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
        SMTPServer.EnableSsl = True
        SMTPServer.Send(MyMailMessage)
        MsgBox("Email Has being Succesfully Sent")
Now press F5 and send an email.

For those to lazy to build this here is the source code for mine - http://www.mediafire.com/download.php?wbdy0txqkyd

It will look alot different because i have removed the labels, but that the code is still the same. I hope you enjoyed this tut and i will post more soon, if you any questions feel free to ask.

Say thanks and +rep if you liked this.
Reply


Messages In This Thread
[TUT] How to make a program that send emails [VB.Net] - by Yoshi - 11-03-2009, 02:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to hook the keyboard. [VB.NET] [TuT] Vorfin 92 55,206 09-23-2019, 11:55 AM
Last Post: Jamimartin
  VB.Net Make a Real AntiVirus (AV) - Part 1 goranpilkic 27 28,455 08-25-2014, 12:43 AM
Last Post: dark_move
  VB.NET Port Scanner [TUT] Fragma 30 12,826 11-27-2012, 11:26 PM
Last Post: ƃu∀ ıʞƃu∀
  [TUT] MD5 Encrypter & Finder [VB.NET] Fragma 12 7,029 11-25-2012, 10:36 PM
Last Post: ƃu∀ ıʞƃu∀
  How To Make And Use A Builder And Stub. [VB.NET] [Source] Vorfin 35 21,175 11-25-2012, 10:34 PM
Last Post: ƃu∀ ıʞƃu∀

Forum Jump:


Users browsing this thread: 2 Guest(s)