Simple Mail Transfer Protocol
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
This code will teach you Step-by-Step how to make a simple emailer. I would recommend this if you are looking to make an emailer, anonymailer, or Ezine emailer.
Original Author: Corey langdon (has since resigned)
Code
This code is a little hard to understand but by going over it a few timew you can EASILY understand SMTP.
First we need to connect to an SMTP server like this:
Winsock1.Connect "SMTP server", "25"
Now that we have connected we need to start the transfer:
Winsock1.Senddata "HELO " + Winsock1.LocalIP + vbCrLf
That starts the transfer. Then You need to Specify who is sending the email:
Winsock1.SendData "MAIL FROM:<" + "MailFrom@blah.com" + " > " + vbCrLf
That will say who it is from. You then need to say who you want to send it to:
Winsock1.SendData "RCPT TO:<" + "Mailto@blah.com" + " > " + vbCrLf
You have specified who to send it to, now you have to tell the server that you are ready to send the contents of the email:
Winsock1.SendData "DATA" + vbCrLf
These are the contents of the email:
Winsock1.SendData "From: <" + "Mailfrom@blah.com" + ">" + vbCrLf + _
"To: " + "Mailto@blah.com" + vbCrLf + _
"Subject: " + "Subject" + vbCrLf
When you have done that you are ready to send the Message and Other data:
"Mime-Version: 1.0" + vbCrLf + _
"Content-Type: text/html" + vbTab + "charset=us-ascii" + vbCrLf + vbCrLf & "Message of Email"
Winsock1.SendData vbCrLf + "." + vbCrLf
Now we need to tell the server that we are done sending the email:
Winsock1.SendData "QUIT"
Please Vote for this bcuz i worked on this for awhile and got kicked offline while doing this. I will accept any critisizm as long as it is appropriate and not bagging on me. I would like it if i could get some votes. Also if you copy and paste this and go over it for awhile then you will have mastered this. It only takes 10 minutes. A couple of suggestions if you are going to make this an actual emailer:
-Change the "Mailto@blah.com" and "Mailfrom@blah.com" to a text box appropriatley fitting them so you can change the Mailer and Reciever.
-Also Put DoEvents: Doevents: Doevents: doevents under The winsock1.Connect "SMTP SERVER", "2"
-Change the "SMTP SERVER" to a combobox or textbox to change servers.
-Email me if you have any Questions.
P.S. I would be in your debt for Five globes :) !
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.