473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

send e-mail using winsock

36
hi for every one

i have program use to send e-mil using winsock and i try to send e-mail from this program but i failure

i write the code of program in here and i want to help me to solve this problem :

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Load()
  2. cdInsertFile.ShowOpen
  3. txtInsertFile.Text = "c:\ReadMe.txt"
  4.  
  5.  
  6.     wsk.Protocol = sckTCPProtocol
  7.     wsk.RemoteHost = "19.154.0.20"
  8.     wsk.RemotePort = 25
  9.     wsk.Connect
  10.  
  11.     Do
  12.         DoEvents
  13.     Loop Until wsk.State = 7
  14.  
  15.     wsk.SendData ("hello flashmail" + vbCrLf)
  16.     wsk.SendData ("MAIL FROM: " & "C-RHQ" & vbCrLf)
  17.     wsk.SendData ("rcpt to: " & "xxx@gmail.com" & vbCrLf)
  18.     wsk.SendData ("data" & vbCrLf)
  19.     wsk.SendData ("Subject: " & "Attach file" & vbCrLf)
  20.     wsk.SendData ("read this file " & vbCrLf)
  21.     wsk.SendData ("." & vbCrLf)
  22.     wsk.SendData ("quit" & vbCrLf)
  23.     wsk.Close
  24.  
  25.  
  26.     Timer1.Interval = 1000
  27.  
  28. End Sub
  29.  
  30. Private Sub Timer1_Timer()
  31. Select Case wsk.State
  32.  
  33.     Case Is = 0: lblStat.Caption = "Closed"
  34.     Case Is = 1: lblStat.Caption = "Open"
  35.     Case Is = 2: lblStat.Caption = "Listening"
  36.     Case Is = 3: lblStat.Caption = "Connection pending"
  37.     Case Is = 4: lblStat.Caption = "Resolving host"
  38.     Case Is = 5: lblStat.Caption = "Host resolved"
  39.     Case Is = 6: lblStat.Caption = "Connecting"
  40.     Case Is = 7: lblStat.Caption = "Connected"
  41.     Case Is = 8: lblStat.Caption = "Peer is closing the connection"
  42.     Case Is = 9: lblStat.Caption = "Error"
  43.  
  44. End Select
  45.  
  46. End Sub
please help me to solve this problem

Question:
can i attach the program in here ?

thank you .
Mar 20 '07 #1
1 2684
ansumansahu
149 100+
hi for every one

i have program use to send e-mil using winsock and i try to send e-mail from this program but i failure

i write the code of program in here and i want to help me to solve this problem :

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Load()
  2. cdInsertFile.ShowOpen
  3. txtInsertFile.Text = "c:\ReadMe.txt"
  4.  
  5.  
  6.     wsk.Protocol = sckTCPProtocol
  7.     wsk.RemoteHost = "19.154.0.20"
  8.     wsk.RemotePort = 25
  9.     wsk.Connect
  10.  
  11.     Do
  12.         DoEvents
  13.     Loop Until wsk.State = 7
  14.  
  15.     wsk.SendData ("hello flashmail" + vbCrLf)
  16.     wsk.SendData ("MAIL FROM: " & "C-RHQ" & vbCrLf)
  17.     wsk.SendData ("rcpt to: " & "xxx@gmail.com" & vbCrLf)
  18.     wsk.SendData ("data" & vbCrLf)
  19.     wsk.SendData ("Subject: " & "Attach file" & vbCrLf)
  20.     wsk.SendData ("read this file " & vbCrLf)
  21.     wsk.SendData ("." & vbCrLf)
  22.     wsk.SendData ("quit" & vbCrLf)
  23.     wsk.Close
  24.  
  25.  
  26.     Timer1.Interval = 1000
  27.  
  28. End Sub
  29.  
  30. Private Sub Timer1_Timer()
  31. Select Case wsk.State
  32.  
  33.     Case Is = 0: lblStat.Caption = "Closed"
  34.     Case Is = 1: lblStat.Caption = "Open"
  35.     Case Is = 2: lblStat.Caption = "Listening"
  36.     Case Is = 3: lblStat.Caption = "Connection pending"
  37.     Case Is = 4: lblStat.Caption = "Resolving host"
  38.     Case Is = 5: lblStat.Caption = "Host resolved"
  39.     Case Is = 6: lblStat.Caption = "Connecting"
  40.     Case Is = 7: lblStat.Caption = "Connected"
  41.     Case Is = 8: lblStat.Caption = "Peer is closing the connection"
  42.     Case Is = 9: lblStat.Caption = "Error"
  43.  
  44. End Select
  45.  
  46. End Sub
please help me to solve this problem

Question:
can i attach the program in here ?

thank you .
Hi ,

Look at this sample code .

http://www.vbip.com/winsock/winsock_simple_sender.asp

There is a sample program that you can download to see hoe this works.

thanks
ansuman sahu
Mar 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom Brown | last post by:
Hi, I have what seems to be a simple problem. But I can not for the life of me find a way to send an integer over a socket. The send method will only accept strings. Here is what I am trying to...
0
by: Piotr Bieniek | last post by:
Hello, I have a problem with UDP sockets. It concerns UdpClient class as well. It throws strange exceptions on subsequent Send calls. Exception is SocketException with native error code 10049. I...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
0
by: Markus Poehler | last post by:
Hi there! I have created NT Service that runs on a Server. It should NET SEND to a specifiv Client in a special case of environment. It does NOT net send. The Messenger Service is running....
1
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
I'm looking for code samples to send a jpg image from a client machine to a host machine. Both have the same image picWindows picture container. I would like to be able to send the image on one...
11
by: Phil Hunt | last post by:
I am porting an VB6 program to .NET C# There is a NET SEND command in the VB6 program. Just wondering if there is any thing similar in the framework. Thanks.
4
by: gvijayaratnam | last post by:
Hi All, I have a fn prototype as follows void print ( char *Buffer, usigned long bufferSize, int chunkSize ); This fn will accept binary file buffer and the buffer size and the chunk size,...
2
by: SvenV | last post by:
I based my program on the asynchronous client/server example on msdn. There weren't too many modifications to the original code. I just created some extra code to response to different messages. F.e....
7
by: Thomas Mlynarczyk | last post by:
Hello, I was playing around a bit with generators using next() and send(). And I was wondering why an extra send() method was introduced instead of simply allowing an argument for next(). ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.