Results 1 to 2 of 2

Thread: having problems with winsock email prog.

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Texas, US
    Posts
    45

    Post

    ok, here is my code....
    [code]
    Private Sub Command1_Click()
    Caption = "Sending Message.."
    If Winsock1.State <> sckClosed Then Winsock1.Close
    Winsock1.Connect """" & txtMailserver & """", 25
    End Sub

    Private Sub Winsock1_Connect()
    Winsock1.SendData "HELO " & Winsock1.LocalIP & vbCrLf & _
    "MAIL FROM: <" & txtMailFrom & ">" & vbCrLf & _
    "RCPT TO: <" & txTto & ">" & vbCrLf & _
    "DATA" & vbCrLf & _
    "TO: " & txTto & vbCrLf & _
    "FROM: " & txtFrom & vbCrLf & _
    "SUBJECT: " & txtSubject & vbCrLf & _
    txtmessage & vbCrLf & "." & vbCrLf & _
    "QUIT" & vbCrLf
    End Sub
    Private Sub Winsock1_SendComplete()
    Caption = "Send Complete."
    End Sub
    [\code]
    please correct this and send it back. I don't know what is wrong with it.
    [code]

    oh, it needs these....
    txtMailserver (where the user types in the mail server of course)
    txtMailFrom(gives the user the choice of entering their real adress or a fake adress)(this is where the user types in an email adress)
    txtfrom(this is where the user types in a name, real or fake, no matter)
    txtto(email adress of recipitent)
    txtsubject(DUH!)
    txtmessage(I think you can figure it out)
    winsock1(the winsock controll)
    command1(the "send email" button)
    [\code]

    problems.....
    no message shows up
    will not connect to mail server
    I'm not Sure what else....
    please help....

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126

    Post

    Try this code...

    Private Sub Command1_Click()
    Caption = "Sending Message.."
    Winsock1.Connect txtMailServer, 25
    End Sub
    Private Sub Winsock1_Connect()
    Winsock1.SendData "HELO " & Winsock1.LocalIP & vbCrLf & _
    "MAIL FROM: <" & txtMailFrom & ">" & vbCrLf & _
    "RCPT TO: <" & TxtTO & ">" & vbCrLf & _
    "DATA" & vbCrLf & _
    "TO: " & TxtTO & vbCrLf & _
    "FROM: " & txtFrom & vbCrLf & _
    "SUBJECT: " & TxtSubject & vbCrLf & _
    txtMessage & vbCrLf & "." & vbCrLf & _
    "QUIT" & vbCrLf
    End Sub
    Private Sub Winsock1_SendComplete()
    Caption = "Send Complete."
    End Sub

    ------------------
    Regards,

    Paul Rivoli
    -------------------
    [email protected]
    http://users.bigpond.com/privoli

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