Z
zhang
what's the problem??
Remote_Addr = "hotmail.com"
sFrom = "<makefriend8@" & Remote_Addr + ">"
Dim oConnection As New TcpClient()
Try
oConnection.SendTimeout = 3000
oConnection.Connect(mserver, 25) ' msserver is right for
example mx4.HOTMAIL.COM
oStream = oConnection.GetStream()
sResponse = GetData(oStream)
sResponse = SendData(oStream, "HELO " & Remote_Addr & vbCrLf)
sResponse = SendData(oStream, "MAIL FROM: " & sFrom & vbCrLf)
If ValidResponse(sResponse) Then
sResponse = SendData(oStream, "RCPT TO: " & sTo & vbCrLf)
If ValidResponse(sResponse) Then
Return 1 'E-mail address is vaild
Else
Return 2 'wrong address
End If
End If
SendData(oStream, "QUIT" & vbCrLf)
oConnection.Close()
oStream = Nothing
Catch
Return 3 ' why go here?? no matter the address is right or
wrong.
Private Function GetData(ByRef oStream As NetworkStream) As String
Dim bResponse(1024) As Byte
Dim sResponse As String
Dim lenStream As Integer = oStream.Read(bResponse, 0, 1024)
If lenStream > 0 Then
sResponse = Encoding.ASCII.GetString(bResponse, 0, 1024)
End If
Return sResponse
End Function
Private Function SendData(ByRef oStream As NetworkStream, ByVal sToSend
As String) As String
Dim sResponse As String
Dim bArray() As Byte = Encoding.ASCII.GetBytes(sToSend.ToCharArray)
oStream.Write(bArray, 0, bArray.Length())
sResponse = GetData(oStream)
Return sResponse
End Function
Private Function ValidResponse(ByVal sResult As String) As Boolean
Dim bResult As Boolean
Dim iFirst As Integer
If sResult.Length > 1 Then
iFirst = CType(sResult.Substring(0, 1), Integer)
If iFirst < 3 Then bResult = True
End If
Return bResult
End Function
Remote_Addr = "hotmail.com"
sFrom = "<makefriend8@" & Remote_Addr + ">"
Dim oConnection As New TcpClient()
Try
oConnection.SendTimeout = 3000
oConnection.Connect(mserver, 25) ' msserver is right for
example mx4.HOTMAIL.COM
oStream = oConnection.GetStream()
sResponse = GetData(oStream)
sResponse = SendData(oStream, "HELO " & Remote_Addr & vbCrLf)
sResponse = SendData(oStream, "MAIL FROM: " & sFrom & vbCrLf)
If ValidResponse(sResponse) Then
sResponse = SendData(oStream, "RCPT TO: " & sTo & vbCrLf)
If ValidResponse(sResponse) Then
Return 1 'E-mail address is vaild
Else
Return 2 'wrong address
End If
End If
SendData(oStream, "QUIT" & vbCrLf)
oConnection.Close()
oStream = Nothing
Catch
Return 3 ' why go here?? no matter the address is right or
wrong.
Private Function GetData(ByRef oStream As NetworkStream) As String
Dim bResponse(1024) As Byte
Dim sResponse As String
Dim lenStream As Integer = oStream.Read(bResponse, 0, 1024)
If lenStream > 0 Then
sResponse = Encoding.ASCII.GetString(bResponse, 0, 1024)
End If
Return sResponse
End Function
Private Function SendData(ByRef oStream As NetworkStream, ByVal sToSend
As String) As String
Dim sResponse As String
Dim bArray() As Byte = Encoding.ASCII.GetBytes(sToSend.ToCharArray)
oStream.Write(bArray, 0, bArray.Length())
sResponse = GetData(oStream)
Return sResponse
End Function
Private Function ValidResponse(ByVal sResult As String) As Boolean
Dim bResult As Boolean
Dim iFirst As Integer
If sResult.Length > 1 Then
iFirst = CType(sResult.Substring(0, 1), Integer)
If iFirst < 3 Then bResult = True
End If
Return bResult
End Function