Text2.Text))
End Sub
Private Sub Command2_Click()
state = 0
smtpClient.Close
smtpClient.Connect
End Sub
Private Sub Form_Load()
mailcount = 2
FLAG_LINE_END = Chr(13) + Chr(10)
FLAG_MAIL_END = FLAG_LINE_END + "." + FLAG_LINE_END
End Sub
Private Sub Form_Terminate()
smtpClient.Close
End Sub
Private Sub smtpClient_Close()
''MsgBox "closed!"
state = 0
End Sub
Private Sub smtpClient_DataArrival(ByVal bytesTotal As Long)
Dim s As String
smtpClient.GetData s
Text1.Text = Text1.Text + s + FLAG_LINE_END
Dim msgHead As String
msgHead = Left(s, 3)
Dim msgBody As String
msgBody = Mid(s, 5)
Dim msgType As Integer
msgType = CInt(msgHead)
Dim msgsend As String
Select Case state
Case 0 ''start state
Select Case msgType
Case 220
msgsend = "EHLO yourname" + FLAG_LINE_END
smtpClient.SendData msgsend
Text1.Text = Text1.Text + msgsend + FLAG_LINE_END
state = 1
Case 421 ''Service not available
End Select
Case 1 ''EHLO
Select Case msgType
Case 250
msgsend = "AUTH LOGIN" + FLAG_LINE_END
smtpClient.SendData msgsend
Text1.Text = Text1.Text + msgsend + FLAG_LINE_END
state = 2
Case 500, 501, 504, 421 ''error happened
End Select
Case 2 ''AUTH LOGIN
Select Case msgType
Case 334
If msgBody = "VXNlcm5hbWU6" + FLAG_LINE_END Then
&nb