Quick Search for:  in language:    
SMTP,WITH,OUT,Allows,sending,email,directly,f
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

CString v1.5
By Ultimatum on 7/2


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

SMTP: Simple Mail Testing Program

Print
Email
 

Submitted on: 4/17/1999
By: Brian Anderson  
Level: Not Given
User Rating: By 2 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this code 36532 times.
 
 
     Allows sending of e-mail (SMTP) directly from a VB app using Winsock, WITH OUT having to buy an expensive add on componet
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: SMTP: Simple Mail Testing Progra
'     m
' Description:Allows sending of e-mail (
'     SMTP) directly from a VB app using Winso
'     ck, WITH OUT having to buy an expensive 
'     add on componet
' By: Brian Anderson
'
' Inputs:Requires: Server Address (Name 
'     or IP), Senders & Recipeient's Names, Se
'     nder & Recipient E-Mail address, Body of
'     message
'
' Returns:Nothing really, does give stat
'     us on sending operation
'
' Assumes:Very straight forward. Makes s
'     ending mail from a VB program EASY!
'
' Side Effects:NONE!
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=841&lngWId;=1'for details.'**************************************

Dim Response As String, Reply As Integer, DateNow As String
Dim first As String, Second As String, Third As String
Dim Fourth As String, Fifth As String, Sixth As String
Dim Seventh As String, Eighth As String
Dim Start As Single, Tmr As Single
Sub SendEmail(MailServerName As String, FromName As String, FromEmailAddress As String, ToName As String, ToEmailAddress As String, EmailSubject As String, EmailBodyOfMessage As String)

Winsock1.LocalPort = 0 ' Must Set local port To 0 (Zero) or you can only send 1 e-mail per program start If Winsock1.State = sckClosed Then ' Check To see if socet is closed DateNow = Format(Date, "Ddd") & ", " & Format(Date, "dd Mmm YYYY") & " " & Format(Time, "hh:mm:ss") & "" & " -0600" first = "mail from:" + Chr(32) + FromEmailAddress + vbCrLf ' Get who's sending E-Mail address Second = "rcpt to:" + Chr(32) + ToEmailAddress + vbCrLf ' Get who mail is going to Third = "Date:" + Chr(32) + DateNow + vbCrLf ' Date when being sent Fourth = "From:" + Chr(32) + FromName + vbCrLf ' Who's Sending Fifth = "To:" + Chr(32) + ToNametxt + vbCrLf ' Who it going to Sixth = "Subject:" + Chr(32) + EmailSubject + vbCrLf ' Subject of E-Mail Seventh = EmailBodyOfMessage + vbCrLf ' E-mail message body Ninth = "X-Mailer: EBT Reporter v 2.x" + vbCrLf ' What program sent the e-mail, customize this Eighth = Fourth + Third + Ninth + Fifth + Sixth ' Combine For proper SMTP sending Winsock1.Protocol = sckTCPProtocol ' Set protocol For sending Winsock1.RemoteHost = MailServerName ' Set the server address Winsock1.RemotePort = 25 ' Set the SMTP Port Winsock1.Connect ' Start connection WaitFor ("220") StatusTxt.Caption = "Connecting...." StatusTxt.Refresh Winsock1.SendData ("HELO yourdomain.com" + vbCrLf) WaitFor ("250") StatusTxt.Caption = "Connected" StatusTxt.Refresh Winsock1.SendData (first) StatusTxt.Caption = "Sending Message" StatusTxt.Refresh WaitFor ("250") Winsock1.SendData (Second) WaitFor ("250") Winsock1.SendData ("data" + vbCrLf) WaitFor ("354") Winsock1.SendData (Eighth + vbCrLf) Winsock1.SendData (Seventh + vbCrLf) Winsock1.SendData ("." + vbCrLf) WaitFor ("250") Winsock1.SendData ("quit" + vbCrLf) StatusTxt.Caption = "Disconnecting" StatusTxt.Refresh WaitFor ("221") Winsock1.Close Else MsgBox (Str(Winsock1.State)) End If
End Sub
Sub WaitFor(ResponseCode As String)
Start = Timer ' Time Event so won't Get stuck In Loop While Len(Response) = 0 Tmr = Start - Timer DoEvents ' Let System keep checking For incoming response **IMPORTANT** If Tmr > 50 Then ' Time In seconds To wait MsgBox "SMTP service error, timed out While waiting For response", 64, MsgTitle Exit Sub End If
Wend
While Left(Response, 3) <> ResponseCode DoEvents If Tmr > 50 Then MsgBox "SMTP service error, impromper response code. Code should have been: " + ResponseCode + " Code recieved: " + Response, 64, MsgTitle Exit Sub End If
Wend
Response = "" ' Sent response code To blank **IMPORTANT** End Sub
Private Sub Command1_Click()
SendEmail txtEmailServer.Text, txtFromName.Text, txtFromEmailAddress.Text, txtToEmailAddress.Text, txtToEmailAddress.Text, txtEmailSubject.Text, txtEmailBodyOfMessage.Text 'MsgBox ("Mail Sent") StatusTxt.Caption = "Mail Sent" StatusTxt.Refresh Beep Close End Sub
Private Sub Command2_Click()
End End Sub
Private Sub Form_Load()
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData Response ' Check For incoming response *IMPORTANT* End Sub

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/12/1999 12:11:00 PM:Rodrigo Calvo
how could I detect automatically which 
is the SMTP mail server?
so that don't 
my clients have to make him manually?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/12/1999 12:13:00 PM:Rodrigo Calvo
how do I detect the mailservername in 
automatic form?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/12/1999 2:11:00 PM:Patrick Clochesy
Rod-
The mailserver cant be detected 
easily. Usually it differs for whatever 
isp they use. You *could* find an open 
one and send it from there. (the server 
has to have relaying turned on.)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/12/1999 6:11:00 PM:mark
any ideas on how to send an 
attachment?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/13/1999 11:25:00 PM:chris
Would anyone happen to know where I can 
find some help on Winsock in VB5/6
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/15/1999 10:32:00 PM:paul sturridge
send me a copy of email source 
code,please.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/18/1999 1:29:00 PM:Raouf El-Messiry
This is what I really was looking for 
for a very long time.
Thank 
you.
Just one question:
Written 
here that this code is submitted Apr 
17, 99
and is accessed 11825 times, 
how ??? :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/19/1999 5:55:00 AM:Dave
I would like to know how to send an 
attachment also
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/19/1999 6:57:00 AM:Wayne Muzzy
I get a "runtime error 10036, a 
blocking winsock operation is in 
progress". What did I do wrong?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/19/1999 8:30:00 AM:Ashraful Alam
How can I send UNICODE(true type font) 
using winsock control.
thanks 
Ashraful
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/21/1999 4:52:00 PM:MjrVodka
is there a good way to find out the 
mail server's name/ip? the only thing 
ive seen done is using a big db and 
searching with the @whatever.com 
(commercial mailers seem to use this 
too)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/21/1999 6:29:00 PM:VB user
Can I make this send the results of a 
form that people fill out so I can get 
feedback on my program? I'm desperate! 
Help me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/23/1999 3:27:00 PM:Dimitri Campana
How to send an attachment? Is 
possible?
Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/1/1999 3:48:00 AM:ccjx
please send me an example of the same 
thing and include the code to send an 
attachment
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/2/1999 3:03:00 PM:Roderick Thompson
An excellent program however a couple 
of errors were observed. 
In the Sub 
WaitFor there is a problem with the 
timings. In the line        Tmr = Start 
- Timer, this will always produce a 
negative value since Timer will always 
be the greater value. Change this line 
to Tmr = Timer - Start.
In addition 
add the line Tmr = Timer - Start below 
the line "While Left(Response, 3) <> 
ResponseCode"
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/4/1999 11:08:00 PM:Michael Lau
Do we have something in reverse, i.e., 
getting e-mail (POP3) codes available 
somewhere anyone?
Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/14/1999 10:13:00 AM:Robert
Seem to have problems with could you 
possible send me a VB file with the 
code running.
Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/16/1999 9:57:00 PM:russ
could you please mail me the 
forms or 
something, I cant get this to work!!!  
=(
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/17/1999 8:03:00 AM:Gerardo Larios Higuera
Could you please mail me the 
forms,or
the project, I cant get this 
to work.
Thanks. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/17/1999 10:07:00 AM:Papaioannou George
How can I send an attachment using that 
mail with Winsock ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/24/1999 2:21:00 PM:Jonathan
i need the ocx that offers winsock1 
used in the code
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/24/1999 3:06:00 PM:ineedhelpineedhelpineedhelp
it says i don't have a licence to use 
winsock control help me!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/25/1999 7:24:00 AM:venkateswara prasad
it is good. it helped me a lot. 
thank 
you
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/25/1999 8:37:00 AM:aa
aa
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/27/1999 9:54:00 AM:OP
I've been looking for way to send an 
attachment with winsock EMail program 
like this, but no luck...Could somebody 
help, please.Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/1/1999 5:09:00 PM:Jason
This is awsomw!  Thanks loads for 
putting it out here...This makes life 
easy....
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/2/1999 9:45:00 AM:EnigMaster
i got an error in the sendmail 
sub
Winsock1.LocalPort = 0 this will 
now work says object required ??? 
anyhelp with this?????
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/4/1999 4:53:00 AM:Meghashyam
How can I send attachments through 
SMTP
How to use POP3
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/5/1999 9:07:00 PM:James Baker
Works well. You need to add the Winsock 
component and a few objects, but 
otherwise it's pretty easy.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/11/1999 9:20:00 PM:FreakboY
where can i get that ocx?
do u have it 
pliz send it to me pliz
thanx
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/12/1999 5:49:00 PM:Jason
I think the code is great, easy to use 
(to most) and effective.  The only 
thing that is missing is a BCC (Blind 
Carbon Copy).  If any of you know the 
code to add it, please email me: 
Mastersoft@email.com.
Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/14/1999 10:06:00 AM:Flash
HOW DO i GET THIS THING TO WORK???
IT 
SAY AN ERROR IN THIS LINE :SendEmail 
txtEmailServer.Text, txtFromName.Text, 
txtFromEmailAddress.Text, 
txtToEmailAddress.Text, 
txtToEmailAddress.Text, 
txtEmailSubject.Text, 
txtEmailBodyOfMessage.Text
Any IDEa 
on how to fix it?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/16/1999 6:59:00 AM:ReBeL16th
it says 'sending message' but nothing 
happens.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/17/1999 10:02:00 AM:Ryan Huettner
ATTACHMENTS.  Need to do 'em.  SMTP.  
Right now would be great.  Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/18/1999 11:02:00 AM:Enmanuel Genovés
I would like to know how to send an 
attachment also in this Smtp sample
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/22/1999 5:00:00 AM:DISEASE_2000
Hmmm... you guy shouldn't post msg and 
say "Why this thing doesn't work?" 
Well... if it doesn't work, then figure 
it out yourself, that's the only way 
you will learn. And I think this code 
will work, because if it won't, then 
why he post it here? so there's must be 
a way of making it work. ;) What come 
inside you is always right! 
---->
"Why doens't it work?"     
"Why doesn't this thing work?"       "I 
got an error!!"        "Can you send me 
the Project file pliz?"            Man, 
all those comment, aren't they annoying 
to you?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/22/1999 4:24:00 PM:Somu
Excellent Code.
Can anyone HELP Me. 
How to send attachments using 
this?
And message as 
HTML?
Thanks
Somu
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/23/1999 5:00:00 PM:E T
Cuold you send me the whole thing, 
project and all?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/24/1999 10:30:00 AM:Jay Otaku
im having some problems. there is an 
error with " Winsock1.LocalPort = 0 ' 
Must set local port to 0 (Zero) or you 
can only send 1 e-mail per program 
start"  also how do you know what your 
mail server is?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/1/1999 2:07:00 AM:Tim
It would be very good if somebody says 
me how to send username and password to 
the server, which requires an 
authorisation...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/2/1999 12:09:00 PM:Yellow Snow
I have gotten it to mail to netzero 
address but it will not mail to Aol and 
Hotmail address. I am thinking that the 
mail servers are to complex or 
something.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/4/1999 4:08:00 AM:Pierrick
A very good tip!!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/5/1999 7:16:00 AM:Leigh
ATTACHMENTS??? Fantastic program, but 
everyone wants to now how to attach 
files. I think you do it during the 
'DATA' phase, but I don't know how. 
Even just how to do it during a telnet 
session (which is effectivly what this 
program does).
THANKYOU.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/5/1999 10:58:00 PM:Hyrax
Wow,  i hope this is an eyeopener, If 
you guys get errors, it is most likely 
a typo, or you fergot to actually look 
at the code. Try doin that sometime. It 
may help you shut-up.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/5/1999 11:08:00 PM:Brian Anderson
I have recieved VERY MANY emails 
regarding email Attachments, and would 
like to say, that the code for this i 
am keeping very private, many others 
know, so you can get it off them. The 
winsck.ocx can be found at many 
Department Stores nation-wide.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/19/1999 10:39:00 AM:blah
can anyone give me a list of mail 
servers that i can use with this code? 
if so please mail me
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/21/1999 3:57:00 AM:Markus
How to send an attachments
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/26/1999 1:16:00 PM:Ge]\/[ini
I need to know how or where to find how 
to send attachments.
Oh yeah, and 
all you people asking why it doesn't 
work:
YOU HAVE TO CREATE THE OBJECT 
IF YOU GET AN OBJECT REQUIRED ERROR.  
If the program looks for 
txtEmailFrom.text and txtEmailFrom dont 
exist then OF COURSE you'll get an 
error. 
jeez...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/3/1999 9:26:00 PM:Julio
I would like to know how to send an 
attachment...
Please!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/6/1999 9:19:00 AM:Francisco Cruz
Muy buen programa heee!!  a mi me va ha 
ahorar trabajo y tiempo porque desde 
hace tiempo quise hacer esto ,, thank 
you!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/15/1999 11:56:00 AM:Hernán Chiapella
Felicitaciones y muchas gracias, me es 
muy útil.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/16/1999 11:32:00 PM:NovaCode
Listen up everyone!
IT DOES WORK SO 
STOP BAGGING BRIAN!
Brian is an 
absolute legend for releasing that 
code, and all you do is post dumb 
remarks. Why don't you lamers look at 
the code yourselves and think why its 
not working.
You need a Winsock 
control on your form or you'll get the 
error - object doesn't exist or 
something.
You need all the text boxes 
with the correct names on them 
(txtEmailServer, txtFromName, etc)
And 
for the server (domain name) you must 
put in your POPMAIL server. e.g. 
Mail.Telstanet.com.au
tmr = start - 
timer should really be tmr = timer - 
start
There, now stop harrasing 
Brian and work it out!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/18/1999 11:58:00 AM:p0_b0y
This is an awesome code.  You other 
people need to get a life.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/23/1999 6:21:00 PM:Centaurus
The code works. AND for all of you 
saying how BAD this code is, it was 
probably not meant to be a stand alone. 
Just a good example of using winsock to 
send text to you. 
If you cant 
figure out where to find the port, then 
you are in trouble :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/29/1999 12:07:00 PM:spacecow
send me the complete source code 
please...thank you very much
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/29/1999 5:07:00 PM:Matt Anderson
The code is good, in that it works, but 
a better way to do it is instead of 
using the WaitFor function, which 
forces a waiting period that might be 
much larger than the time it takes for 
the server to respond.  A better way to 
do it would be to place most of the 
interaction code in the 
Winsock1_DataArrival event, where it 
would decide the next action to take 
and promptly reply.
Also for 
everyone who is asking about sending 
attachments, this is done by adding 
something like this to the header (this 
may not be exactly correct b/c I am 
doing this from 
memory),
to:abc<abc@123.com>
from:def<
def@123.com>
subject: subject 
line...
content-type: 
multipart/attachment border = 
"========123abc"
<attachment goes 
here>
========123abc content-type: 
text/plain
<your message goes 
here>
Anyone interested in 
purchasing a compiled SMTP or POP3 .ocx 
control for a small price, chech out 
http://www.homeworkfinder.com/personal/m
att, a sample program is included
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/5/1999 2:59:00 AM:King Patrik
There's help for both run-time errors 
and the Winsock control itself. Press 
F1 to get help, it's not simpler than 
that!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/9/1999 7:11:00 AM:Me
Yes, this can send attachments, but you 
have to encode the attachment file 
using a compliant uuencode protocol. If 
it took you more than 5 minutes to get 
the above code working, then don't even 
bother trying to write it yourself. 
Otherwise, the algorithms are posted 
all over the web and usenet. There's a 
lotta math involved.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/9/1999 7:42:00 AM:Nicolas Buschittari
Help me !! i need send a attachment, 
Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/9/1999 10:25:00 AM:RasCA* Com
This thing is great, GREAT.
I can 
promiss you that I've searched a lot 
for this thing...
Thank you.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/9/1999 6:14:00 PM:Steve Langdon
ATTENTION!
All you guys that are 
crying "It doesn,t work", "Send me the 
project" &
blah,blah blah.
If you 
want to be a "PROGRAMMER" then 
this
should be your 1st lesson!
NO 
PAIN, NO GAIN! 
If you are that lazy 
then maybe you should go into sales or 
something. YOU don't have what it 
takes!
There is nothing wrong with 
being new and having questions, but 
programming is a lot more than 
Cut,Paste & Run.
Lesson 2. Tear it 
apart and see what makes it 
tick!
Thanks for your time and I 
will now step down from my soapbox!
 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/10/1999 11:51:00 AM:Chuck
I'll take Brians original code and 
convert it for use with an ActiveX 
DLL.
Should I repost it when I'm 
done?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/11/1999 2:06:00 PM:0-C-O-O-L
Just wondering could you tell me is 
there anyway that i could create a 
program that would connect to the 
internet automaticly and send a E-Mail 
automaticly with out the user having to 
do anythink.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/14/1999 8:41:00 AM:-Rockin-
The only way to learn it by example, 
and you need to give a project.  Also, 
you need attachment code, or else your 
program is worthless like all the 
Microsoft apps.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/15/1999 5:30:00 AM:Liron Golan
This didn't help me, the code didn't 
work on my application
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/15/1999 10:58:00 AM:MailGuy
#1 SMTP does not support attachements, 
so give it up, losers.
#2 This code 
replaces the function I purchased IP 
works for.
So if you can't get it 
running, go buy IP*works, and stop 
bugging
the man for more source!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/22/1999 8:36:00 AM:Ryan
what is winsock?
do i need a seperate 
program to run this?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/23/1999 4:59:00 PM:NoName NoGame
Does it work?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/29/1999 7:32:00 AM:Ray
Awesome Code - you can't convert it to 
an Active DLL since it uses a 
Component, right?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/29/1999 9:57:00 PM:Brandon
Just one question.  If I need to send a 
mail to more than one receipient, what 
should be the format/protocol 
'ToEMailAddress' and 'ToNameTxt' 
variables?  Need this answer quite 
urgently.  Appreciate your help.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/10/1999 3:00:00 AM:CarBoX
mail.compuserve.com <--- WORKS GREAT!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/19/1999 6:45:00 PM:cruzerz
I have implemented this code in my FREE 
program. Also made the code work 
better.
http://codearchive.yi.org/explo
it/
has source code avail too!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/27/1999 12:22:00 AM:gnilow
if I use mail.hotmail.com as the 
server,
I can only send mails to 
hotmail accounts? how do I send to 
others?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/3/1999 12:24:00 PM:joris beckers
My winsock doen't work.
please 
help!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/14/1999 9:06:00 PM:Phrostbyte Software
nice
Yes it's possable to add 
attachments Attachements need to be 
send part by part in packets. 
Packetsize is the amount of 8-bit 
(ascii) charters can be sent in one 
shot.
And isn't the mail server the 
@whatever.com part of a e-mail? Like if 
my e-mail was bobdole@usa.net, usa.net 
should be the mail server
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/17/1999 2:57:00 PM:Darryl Anderson
Absolutely Brilliant, works like a 
charm.
Thanks very much.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/18/1999 4:30:58 AM:ND

Excellent

Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/26/2000 1:42:02 PM:afraz
I got error problem in 
command1_click
kindly send me form1 
only
Also how do i send pics
regards
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/31/2000 2:07:49 AM:richard
Hi Brian,
thanks for this real 
eye-opener, great work man!
I have a 
small problem : See, the code
you 
provided works with a form and a 
command button when clicked. I am 
hoping to build it as a sub that can 
run
as soimething like Sub main(). 
Thing is I have included the Winsock 
control component in my project already 
and i can comopile it into .exe but 
when run, the winsock.Localport line 
gives me an error. 
I am new at this 
but i do not intend to plagarise your 
code, Brian. I need your suggestions 
(and the rest of U VB experts out 
there) as to how i can adapt this into 
straight VB code wihtout the use of 
forms/buttons and then just use it as a 
sub in itself.
once again, thanks. 
hope to hear from you soon. 
best 
regards, richard.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/2/2000 7:09:45 PM:afraz
Hey man, I am having problem 
Command1_Click()
the error says 
agruement not optional  ...can u fix it 
or not...
Still waiting for  an 
answer!!!!!!!!!!!!
regards
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/2/2000 7:43:51 PM:afraz
Hey, man. I fixed bug....StatusTxt 
instead of label1.
Hey, man....it is 
WORKING now. 
Hey, man.......Thank 
you..
Hey man...I din't abuse 
you...keep ur work and i need how 
to 
send pics by using richtextbox..it 
could be rtf or seltext or 
selrtf.
Brian, Good work..
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/8/2000 1:36:33 AM:Shiau Chen
Here is my piece of code
Sub 
SendMail()
Dim Winsock1 As 
Winsock
With Winsock1
    .Protocol 
= sckTCPProtocol
    .RemoteHost = 
"csam.com.my"
    .RemotePort = 21
 .Connect
End With
The problem is 
when I debug, when it comes to 
.protocol there will be an erro msg 
saying that Runtime error 91, Object 
variable or with block variable not 
set.
Has tried using Set instead of 
using With but still the same. Pls 
help. Thank you
End Sub
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/21/2001 7:45:03 AM:Trey Smith
First off EXCELLENT CODE!
You have a 
very firm grasp of SMTP.  Your class... 
well it's horrible, but the code works 
so well, I'm going to go the distance 
and re-structure it.  Ok everyone who's 
having problems.  His code uses an 
older object creation meathod, so you 
have to do a little trick.  Create a 
form1.  Create a winsock control on it 
copy paste it onto the form.  It will 
ask if you wish to make a control array 
emement. Say YES.  Now delete the 
second instance.  This is done so his 
class can create more winsock controls. 
 Then try this
    With clsHerb
  .Attach Form1
    end with
that 
will bind the form to his class.
oh.. 
Shiau Chen, you forgot to do the new 
statement.  Example:
dim a as clsHerb 
set a= new clsHerb
That should do it. 
I'll have a new version of the class 
submitted to Herb hopefully later this 
week, I'll add what features I can to 
make it simpler for you whom are 
struggling.  You can also reach me at 
tsmith@impgraphics.com
-Trey
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/2/2002 8:19:53 AM:Jaspreet
please specify the code for how ro 
Speicify MIME type from winsock control 
in vb
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/3/2003 4:35:38 PM:
Why does everyone think this code is so 
great?  There are already example 
programs on PlanetSourceCode that 
already does pretty much this very same 
thing.  I mean, anyone can take this 
code and make a few changes to it and 
post it on this site.... BIG DEAL.  
Brian claims that he is keeping the 
code for the mail attachments very 
private.  He acts like it is some piece 
of state of the art software but you 
can search the internet and find all 
sorts of info.  I would bet that he 
doesn't even know how to do it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.