Re: Coding the Winsock control....
From: Brad Pears (donotreply_at_notreal.com)
Date: 11/22/04
- Next message: neilmber: "Word wrapping a combo box?"
- Previous message: George Nicholson: "Re: Click button show results in subform"
- In reply to: Alex Ivanov: "Re: Coding the Winsock control...."
- Next in thread: Alex Ivanov: "Re: Coding the Winsock control...."
- Reply: Alex Ivanov: "Re: Coding the Winsock control...."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Nov 2004 16:58:20 -0500
So to test this, do I just add the ActiveX Microsoft Winsock version 6
control to my form and
rename the winsock control to "winsock1"?? When I add the control it's
named something completely different... (ActiveXctl1)
Should I be worried about that?
Not sure how to test this...
Thanks,
Brad
"Alex Ivanov" <consul@collegeclub.com> wrote in message
news:OI49CkUyEHA.260@TK2MSFTNGP11.phx.gbl...
> I accidentally swithced "from" and "to" this caused rejection from my isp.
> This is the corrected code that works.
> If you need to send the mail to external clients, you will need either to
> add an authentication code or set the RemoteHost property to their mail
> servers before sending (unless you have an 'open proxy' allowing mail
> forwarding).
>
> HTH
>
> Option Explicit
>
> Private Sub Form_Load()
> With Winsock1
> .RemoteHost = "test.net"
> .RemotePort = 25
> .Protocol = sckTCPProtocol
> .Connect
> End With
> End Sub
>
> Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
> Dim buf As String
> Dim retcode As Integer
> Static c250 As Integer
> Dim numOfRecipients
> numOfRecipients = 1
> buf = Space(Winsock1.BytesReceived)
> Winsock1.GetData buf, vbString
> Debug.Print buf
> retcode = Val(Left(buf, 3))
> Select Case retcode
> Case 220
> Winsock1.SendData "helo nothing.com" & vbCrLf
> c250 = 0
> Case 250
> If c250 = 0 Then
> Winsock1.SendData "mail from: test@test" & vbCrLf
> c250 = c250 + 1
> ElseIf c250 < numOfRecipients + 1 Then
> Winsock1.SendData "rcpt to: consul@test.net" & vbCrLf
> c250 = c250 + 1
> ElseIf c250 = numOfRecipients + 1 Then
> Winsock1.SendData "data" & vbCrLf
> c250 = c250 + 1
> Else
> Winsock1.SendData "quit" & vbCrLf
> End If
> Case 354
> Winsock1.SendData "Subject: My Subject" & vbCrLf _
> & "From: Me" & vbCrLf & vbCrLf _
> & "Your data goes here." & vbCrLf & "." & vbCrLf
> Case 221
> Winsock1.Close
> MsgBox "Mail Sent"
> End Select
> End Sub
>
>
> --
> Please reply to NG only. This email is not monitored.
> Alex.
>
>
> "Alex Ivanov" <consul@collegeclub.com> wrote in message
> news:%23vfq1KUyEHA.3840@tk2msftngp13.phx.gbl...
> > This is a barebone code with no authentication and no encryption. Some
> > mail servers may accept similar requests other not.
> > My home ISP's mail server silently ignores the email sent this way
though
> > it seems that send succeeds. Our company's Exchange server is happy to
> > work with it if the mail is sent to internal recipients. Anyway, you can
> > try.
> >
>
>
- Next message: neilmber: "Word wrapping a combo box?"
- Previous message: George Nicholson: "Re: Click button show results in subform"
- In reply to: Alex Ivanov: "Re: Coding the Winsock control...."
- Next in thread: Alex Ivanov: "Re: Coding the Winsock control...."
- Reply: Alex Ivanov: "Re: Coding the Winsock control...."
- Messages sorted by: [ date ] [ thread ]