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.
If everything went correct your page should look like the one below. Just click properties and follow the next steps.
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.
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.
Your screen should now loo like the one below.
Now go click form1design tab and Double-click The send button and paste this code in
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.
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.
If everything went correct your page should look like the one below. Just click properties and follow the next steps.
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.
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
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")
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.