VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Mail Transfer Protocol

by Corey langdon (has since resigned) (4 Submissions)
Category: Coding Standards
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (11 Votes)

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.

Rate Simple Mail Transfer Protocol

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:<" + "[email protected]" + " > " + vbCrLf


That will say who it is from. You then need to say who you want to send it to:


Winsock1.SendData "RCPT TO:<" + "[email protected]" + " > " + 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: <" + "[email protected]" + ">" + vbCrLf + _


 "To: " + "[email protected]" + 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 "[email protected]" and "[email protected]" 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 :) !

Download this snippet    Add to My Saved Code

Simple Mail Transfer Protocol Comments

No comments have been posted about Simple Mail Transfer Protocol. Why not be the first to post a comment about Simple Mail Transfer Protocol.

Post your comment

Subject:
Message:
0/1000 characters