|
[VB.NET][TUT]Simple Smtp CLient[/TUT][/VB.NET]
|
|
07-20-2010, 09:53 PM
Post: #1
|
|||
|
|||
|
[VB.NET][TUT]Simple Smtp CLient[/TUT][/VB.NET]
Hello everyone and welcome to my first tutorial on CEH
I have been thinking about writing a tutorial for a while now and I have noticed that there wasn't an smtp client tutorial here. So I decided to make an easy to follow tutorial that teaches you to make a simple smtp client that supports multiple recipients :) You will notice that I have commented nearly every piece of code to make it easy for you to follow. This is what you guys will make if you follow this tutorial. ![]() So let's get started. First we need to open a new "Windows forms application" And name it anything you like as long as you will remember what it is. Now that you are looking at "Form 1". This what you need to add. 5 Text Boxes, 4 Labels, 3 Group Boxes(not necessary but they make the form look better) 1 Button. Please arrange your form like this. And name the components as I have shown. ![]() Now please right click on the text box that is named txtMyPass and select properties. Once that is done scroll down until you see "PasswordChar and enter the star character beside it as shown in this image. ![]() Now before we begin coding the program we must add imports. So above "Public Class Form1" add the following code. Just remember not to add "Public Class Form1" as it is already in the code. ![]() Now we have to add the global variables. These variables just make coding shorter and must be place in between "Public Class Form1" and "Private Sub Form1_Load" method. ![]() Now go back to the Form designer and double click on the Send Button. You will now enter this code. ![]() What this code does is it checks the email address you entered and sets the smtp server address that is needed. Now we declare the port numbers. Write this bellow the last piece of code. ![]() Now we shall add the credentials(your email address and password) so the email will send. ![]() Now we are going to add the recipients. this is the most difficult piece of code in this tutorial but the funny thing is that it isn't difficult at all :) ![]() Here we use a for each loop that split's the recipient list where ever there is a " ; " symbol(so each email address you wan't to send the email to must be separated by a " ; " symbol also known as a semi colon. Then we add each recipient separately :) This next piece of code may not seem important but you need it or it won't send the email :( We are adding our email to the mail.From function. ![]() this piece of code checks if the user entered a subject and if they didn't it will set the subject as "No Subject" :) ![]() Now for the last pieces of code we shall add the body(the message you want to send) and add the send command :) ![]() Congratulations you have made your own smtp client that supports multiple recipients :) If you use these codes please give me a little bit of credit. Even if it is a small comment in the source :) I hope I have helped you all and I shall make more tutorials if you guys find this tutorial helpful :) Thank you for reading. |
|||
|
07-29-2010, 05:47 AM
Post: #2
|
|||
|
|||
|
RE: [VB.NET][TUT]Simple Smtp CLient[/TUT][/VB.NET]
Great tutorial man.
I am sure that many newbies will learn from that |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread:



![[Image: Preview.gif]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Preview.gif)
![[Image: Form1Preview.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Form1Preview.jpg)
![[Image: passchar.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/passchar.jpg)
![[Image: Imports.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Imports.jpg)
![[Image: Variables.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Variables.jpg)
![[Image: Email.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Email.jpg)
![[Image: Ports.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Ports.jpg)
![[Image: Credentials.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Credentials.jpg)
![[Image: mailto.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/mailto.jpg)
![[Image: mailfrom.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/mailfrom.jpg)
![[Image: Subjectornosubject.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Subjectornosubject.jpg)
![[Image: Bodyandsend.jpg]](http://i884.photobucket.com/albums/ac47/shadow_69_91/Bodyandsend.jpg)
