Page 1 of 2 12 LastLast
Results 1 to 40 of 41

Thread: winsock smtp emailer working, but not quite right

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    winsock smtp emailer working, but not quite right

    Hey all.
    I'm using a code I found on this site to send email.
    The email is coming from one of my website domain emails and going to the same email.
    I'm using Outlook to confirm receipt of the emails.
    Everything is working except that the body of the message is not coming through.

    I'm using Winsock and the commands look like:

    Winsock1.SendData "Date: " & Format(Date, " dd mmm yy ") & Time & vbCrLf
    'To:
    Winsock1.SendData "TO:<" & mvarRecipient & ">" & vbCrLf
    'From:
    Winsock1.SendData "From: <" & mvarSender & ">" & vbCrLf
    'Subject:
    If Not mvarSubject = "" ThenWinsock1.SendData "Subject:" & mvarSubject & vbCrLf
    'Body
    Winsock1.SendData "Body Line 1." & vbCrLf
    Winsock.SendData "Body Line 2." & vbCrLf
    Winsock1.SendData "." & vbCrLf
    Winsock1.SendData "QUIT"
    Winsock1.Close

    The emails are going through, the information is all correct, but the body part is not coming out in the body part of Outlook. It is blank.

    Any ideas?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  2. #2

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Quote Originally Posted by wengang View Post
    Hey all.
    I'm using a code I found on this site to send email.
    The email is coming from one of my website domain emails and going to the same email.
    I'm using Outlook to confirm receipt of the emails.
    Everything is working except that the body of the message is not coming through.

    I'm using Winsock and the commands look like:

    Winsock1.SendData "Date: " & Format(Date, " dd mmm yy ") & Time & vbCrLf
    'To:
    Winsock1.SendData "TO:<" & mvarRecipient & ">" & vbCrLf
    'From:
    Winsock1.SendData "From: <" & mvarSender & ">" & vbCrLf
    'Subject:
    If Not mvarSubject = "" ThenWinsock1.SendData "Subject:" & mvarSubject & vbCrLf
    'Body
    Winsock1.SendData "Body Line 1." & vbCrLf
    Winsock.SendData "Body Line 2." & vbCrLf
    Winsock1.SendData "." & vbCrLf
    Winsock1.SendData "QUIT"
    Winsock1.Close

    The emails are going through, the information is all correct, but the body part is not coming out in the body part of Outlook. It is blank.

    Any ideas?
    Not a good idea. You are closing the socket immediately after you send data. You need to give it time to be sent before you close the socket.

    You might try this:

    Code:
    Private Sub SomeSub()
     Dim EmailMessage As String'
     
     EmailMessage = "Date: " & Format(Date, " dd mmm yy ") & Time & vbCrLf  
     EmailMessage = EmailMessage & "TO:<" & mvarRecipient & ">" & vbCrLf    
     EmailMessage = EmailMessage & "From: <" & mvarSender & ">" & vbCrLf       
     
     If Not mvarSubject = "" Then EmailMessage = EmailMessage & "Subject:" & mvarSubject & vbCrLf
    
     EmailMessage = EmailMessage & "Body Line 1." & vbCrLf
     EmailMessage = EmailMessage & "Body Line 2." & vbCrLf & "." & vbCrLf
     EmailMessage = EmailMessage & "QUIT"
    
     Winsock1.SendData EmailMessage & vbCrLf
    End Sub
    
    Private Winsock1_Close()
     Winsock1.Close
    End Sub
    Last edited by jmsrickland; Jun 12th, 2011 at 01:38 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: winsock smtp emailer working, but not quite right

    You don't have to close the connection, the Server will close it. Just code the Winsock_Close event to close.
    Code:
    Private Sub Winsock1_Close()
    Winsock1.Close
    End Sub
    BTW you need to send vbCrLf & "." & vbCrLf at the end of the Body of the message.
    Last edited by Doogle; Jun 12th, 2011 at 01:17 AM.

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    BTW you need to send "." & vbCrLf & vbCrLf at the end of the Body of the message.

    EmailMessage = EmailMessage & "Body Line 1." & vbCrLf
    EmailMessage = EmailMessage & "Body Line 2." & vbCrLf & vbCrLf

    Isn't this what you're refering to?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: winsock smtp emailer working, but not quite right

    Thanks, I just edited my BTW - according to the SMTP protocol the Body is terminated by vbCrLf & "." & vbCrLf
    (ie a "." on a line by itself.)

  7. #7
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Quote Originally Posted by Doogle View Post
    You don't have to close the connection, the Server will close it. Just code the Winsock_Close event to close.


    Private Winsock1_SendComplete()
    Winsock1.Close
    End Sub

    Oops!, I meant _Close().

    Thanks, Doogle, for pointing that out.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Quote Originally Posted by Doogle View Post
    Thanks, I just edited my BTW - according to the SMTP protocol the Body is terminated by vbCrLf & "." & vbCrLf
    (ie a "." on a line by itself.)

    Yep. you caught another one. Good going.


    Code:
      '
      '
     EmailMessage = EmailMessage & "Body Line 2." & vbCrLf & "." & vbCrLf
     EmailMessage = EmailMessage & "QUIT"
    
     Winsock1.SendData EmailMessage & vbCrLf
      '
      '
    Last edited by jmsrickland; Jun 12th, 2011 at 01:32 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Actually, the best way to do Email using Winsock is to use the DataArrival event so you can respond correctly to the server's responses.

    Here is what I use but you may have to change it to fit your situation as my email server requires login authentication.

    Code:
    Private Sub sckSMTP_DataArrival(ByVal bytesTotal As Long)
     Dim s As String
     Dim ReturnCode As String
    
     Static SessionCounter As Integer
     
     sckSMTP.GetData s, vbString
    
     ReturnCode = Left(s,3) 
     
     SessionCounter = SessionCounter + 1
      
     Select Case SessionCounter
       Case 1 
         If ReturnCode = "220" Then 
           sckSMTP.SendData "EHLO" & vbCrLf
         Else
           EmailError 1, s
         End If
    
       Case 2 
         If ReturnCode = "250" Then
           sckSMTP.SendData "AUTH LOGIN" & vbCrLf
         Else
           EmailError 2, s
         End If
    
       Case 3 
         '
         ' Server sends "VXNlcm5hbWU6" which is "Username:" in Base64
         '
         If ReturnCode = "334" Then 
           sckSMTP.SendData "cm.........bnM=" & vbCrLf ' Send Username in Base64
         Else
           EmailError 3, s
         End If
         
       Case 4 
         '
         ' Server sends "UGFzc3dvcmQ6" which is "Password:" in Base64
         '
         If ReturnCode = "334" Then
           sckSMTP.SendData "cH.....Mw==" & vbCrLf ' Send Password in Base64
         Else
           EmailError 4, s 
         End If
       
       Case 5 
         If ReturnCode = "235" Then
           sckSMTP.SendData "MAIL FROM: " & cboFrom.Text & vbCrLf 
         Else
           EmailError 5, s
         End If
       
       Case 6 
         If ReturnCode = "250" Then 
           sckSMTP.SendData "RCPT TO: " & cboTo.Text & vbCrLf
         Else
           EmailError 6, s
         End If
       
       Case 7 
         If ReturnCode = "250" Then
           sckSMTP.SendData "DATA" & vbCrLf
         Else
           EmailError 7, s
         End If
         
       Case 8 
         If ReturnCode = "354" Then
           Dim DatePart As String
           Dim FromPart As String
           Dim SubjectPart As String
           Dim ToPart As String
           Dim Message As String
         
           DatePart = "Date: " & Format(Now, "ddd, dd mmm yyyy hh:mm:ss") & " -0700 (PDT)" & vbCrLf
           FromPart = "From: " & cboFrom.Text & vbCrLf
           SubjectPart = "Subject: " & txtSubject & vbCrLf
           ToPart = "To: " & cboTo.Text & vbCrLf
           Message = txtMessage.Text & vbCrLf
         
           sckSMTP.SendData DatePart & FromPart & SubjectPart & ToPart & Message & "." & vbCrLf    
          Else
            EmailError 8, s
          End If
         
       Case 9 
         If ReturnCode = "250" Then
           sckSMTP.SendData "QUIT" & vbCrLf
         Else
           EmailError 9, s
         End If
         
       Case 10 
         If ReturnCode = "221" Then
           Exit Sub
         Else
           EmailError 10, s
         End If
     End Select
    End Sub
    
    Private Sub sckSMTP_Close()
     sckSMTP.Close
    End Sub
    
    Private Sub EmailError(StepNumber, ServerResponse As String)
     '
     ' Do what you need to do
     '
    End Sub


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    OK.
    THe body of the email is showing up.
    So that is working.

    The only problem I'm stuck with is that I can only send an email to my own server.
    i.e. I can send from [email protected] to [email protected] using host mail.ggg.com
    and port 2525

    But I can't get it to send email to yahoo, for example.

    I don't quite get the part about authentication. I am only sending email out and I won't have any kind of authentication info on the email recipient. Of course I can use my own Yahoo address for testing, but so far, that throws out error 550 (user is not known on this server).
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  11. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    I'm getting a little confused here.

    Exactly from where are you using your email application? From your home or office?

    What do you mean your own server? Is this your email server?

    I don't think Yahoo or any public mail system uses SMTP. Maybe that's why you can't do it. Give me a valid yahoo email so I can test with it.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  12. #12

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    I think the problem is mine. I'm probably misusing terminology.

    I own a website, suppose it is www.ggg.com
    I have set up email addresses on this website's email hosting:
    [email protected] [email protected], etc

    I can use mail.ggg.com as the server in this SMTP email code, and I can send email from [email protected] to [email protected],
    but I can't send an email to my yahoo email.

    That address is [email protected]

    It already gets a lot of spam, so no harm showing it here.

    Am I using the wrong code for that?
    The point is, whichever code I use, I need to be able to send email to any address I put in.

    I can use my website's email host as the SMTP host, and I can use my website email address for the From address, and now the system is working, and the mails are being sent when I send email to my own website email address.

    But when I try to send email to Yahoo, I get error 550 from winsock.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  13. #13
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    OK, let me know if you get anything like test in the yahoo email


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  14. #14

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    nothing so far.
    does it take a while?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  15. #15

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    I just got one "Another Test"
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  16. #16
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    OK, I'm still testing to see how I did it


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  17. #17

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    in that case, let me update you.
    I think I got all the messages:

    1st one was no subject, "Test"
    2nd one was "TEst", "ANother Test"
    3rd one was "Here's ANother", "Post if you get this one with subject"
    4th one was "test one", "This is Test one"
    5th one was "test two", "This is Test two"
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  18. #18
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    OK, "test one" came from my website. "test two" came from my Winsock program just like the one I posted on this thread. The others I'm not sure but probably from the Winsock program.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  19. #19

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    I did see that. It's just that it had its own .dll and I didn't know if that was something you wrote or just something written anonymously, so I didn't pursue it.
    Did you write this app, or do you know who did?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  20. #20

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    I tried to run this app, and I got the same error 550: no such user here
    that happens when I put [email protected] in the recipient email line

    and it works when I put my own website's email address in there.

    So it's the same result as the othe SMTP sample I've been using.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  21. #21
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Quote Originally Posted by wengang View Post
    I did see that. It's just that it had its own .dll and I didn't know if that was something you wrote or just something written anonymously, so I didn't pursue it.
    Did you write this app, or do you know who did?
    If you are refering to the zip or the posted code? Neither one has a dll associated with it as far as I know.

    Yes, I wrote the SMTP program.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  22. #22
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    Use your program and the one I posted (zip or code in thread) and send me two emails. Number them and say which you are using:

    [email protected]


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  23. #23
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    I tried to run this app, and I got the same error 550: no such user here
    that happens when I put [email protected] in the recipient email line


    Then how can it be explained that I was able to send email using the same Winsock program that I posted here.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  24. #24

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    550 "No such user here"
    in both programs
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  25. #25

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    Oh.
    I got mixed up.
    I followed a link to a zip from RhinoBull at the top of this thread. It uses vbSendMail.dll
    That gives me 550.

    I haven't seen your app here.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  26. #26
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    I haven't seen your app here.

    Post #9 and the zip is in your other thread.

    So, now that 550 taken care of does it work?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  27. #27
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: winsock smtp emailer working, but not quite right

    I just sent you both an e-mail using the code from the Codebank (http://www.vbforums.com/showthread.p...highlight=smtp) without a problem.

  28. #28

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    JMS
    I just tried your app and it gives the message "message sent" but then immediately followed with another msgbox "Error: Number = 10053, REason = Connection is aborted due to timeout or other failure.

    I put in my website's email host and 2525 as the port. Those have been working with the other codes I've tried.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  29. #29

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    Doogle
    That code works for me too, but it's the same problem.
    When I try to send to my yahoo address, it gives me error 550 on winsock
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  30. #30

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    JMS, in case I wasn't clear, the email never went through, but I do get "message sent"
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  31. #31
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: winsock smtp emailer working, but not quite right

    Quote Originally Posted by wengang View Post
    Doogle
    That code works for me too, but it's the same problem.
    When I try to send to my yahoo address, it gives me error 550 on winsock
    I assume you got the message I sent (?) If so, then your problem lies with your SMTP server not with your Winsock Client.

  32. #32

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    Doogle
    yes, that was one of the first ones I tried.

    I'm not sure what SMTP means.
    I do know that I can send email via ASP code on my website using CDONTS, and it sends to any email address.
    I'm just trying to have that same capability in VB (without using a Webbrowser, etc)
    What might the problem with the server be?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  33. #33

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    also, when I use outlook, I can send to Yahoo mail from my website's email host address
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  34. #34
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: winsock smtp emailer working, but not quite right

    I'm not sure, but are you using a Sender e-mail address that's recognised by the server ?

    ie if you connect to an SMTP Server: 'server.isp.com' does your 'Sender' field end with '.isp.com' ?

  35. #35
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    I'm not sure what SMTP means.

    Simple Mail Transfer Protocol

    The most common email protocol in use.


    Did you use the application from the zip file or the code posted on this thread?

    The code that I used to send email to your Yahoo account is the same code I put in a zip file on your other thread.

    So, if I was able to do it and if you used that same application (except you will have to use your own SMTP email server) then like Doogle said its your server that is not allowing it or understanding what you are sending it or you are out of sequence in the DataArrival event.
    Last edited by jmsrickland; Jun 12th, 2011 at 06:06 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  36. #36

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    yes, it was the zip file from the other thread.
    It works to send to the email address on my web host, but does not work to send to yahoo.

    Here is where the code stops:

    mvarWinsock.SendData "RCPT TO:<" & mvarRecipient & ">" & vbCrLf
    MsgBox (WaitFor(OK))
    If WaitFor(OK) Then

    GiveError
    mvarWinsock.Close
    Exit Sub
    End If

    I inserted the msgbox to confirm that it never returns a value from WaitFor() after it sends mvarRecipient (when mvarRecipient is my yahoo address)

    I put a debug.print inside the WaitFor loop and the result was that for about 10 seconds or so, it returns value 550
    Then it switches to value 503 for maybe 10 more seconds
    then it switches to value 500 and stays on that until eventually the app crashes trying to close mvarWinsock.Senddata "Quit".
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  37. #37
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    yes, it was the zip file from the other thread.
    It works to send to the email address on my web host, but does not work to send to yahoo.


    That's the same one (except slightly changed for my server) I used to send you a message at Yahoo.

    The code you are posting is not from that program. You should use a DataArrival event like I do. That way you can catch each return response from your email server at the point you believe it should be at. One thing about SMTP you must respond with the correct response or you will not be able to send mail because you can get out of sync and that will screw up everything.

    BTW: Who is your primary email server? Is it your ISP?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  38. #38

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604

    Re: winsock smtp emailer working, but not quite right

    it's not my isp, it's the webhost where I have several websites.
    The email addresses are from my domains.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  39. #39

  40. #40
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: winsock smtp emailer working, but not quite right

    it's not my isp, it's the webhost where I have several websites.
    The email addresses are from my domains.


    So how do you make your Winsock application (Im assuming you are running it on your home computer) connect to your Host? For example, if you send me email at [email protected] it will go to my mailbox at the hosting server machine. If I want to send email from my Website I have to logon to my WebSite an click on a button that brings up the Mail Panel. From there I can type a email message and click on send. But I have to be at the WebSite to do this. How does your program handle this? I'm a little lost here when you say you send out email from your website yet your website is not the OS that your VB Winsock is running on. So what are you doing to make this happen?

    I guess where I'm getting confused is how do you send email to your email server at the host and then have it be sent to a Yahoo address? If I send me email at jms@codeavenue it will go to my inbox at the host email server for me. I can, however send email to me and also have me as the recipient but I cannot have someone else be the recipient. Understand? Now, if I went to my Website and logged in at the mail panel then I can send to someone else but not from my home. I really need to get a clear understanding what you are doing.
    Last edited by jmsrickland; Jun 12th, 2011 at 09:57 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width