'Please consciously respect your copyright! Free Pentium (WGSCD) 2004-12
Imports Microsoft.VisualBasicImports Microsoft.Win32Imports System.NetImports System.IOImports System.ThreadingImports System.Net.Sockets'VideoCampture using VB.NET 'author: Freedom Pentium wgscd@126.com' website: http: //www.shizhu.net ' QQ: 153964481 '2004 11-26public class form1 inherits system.windows.forms.form
#Region "Windows Form Designer Generated Code"
Public Sub new () mybase.new ()
'This call is required for the Windows Form Designer. InitializeComponent ()
'Add any initialization after INITIALIZECOMPONENT ()
End Sub
'Form rewriting Dispose to clean up the list of components. Protected overloads overrides sub dispose (byval disposing as boolean) ing disponation kiln (Components Is Nothing) Then components.dispose () end if endiffs) End sub
'Windows Form Designer Supply Private Components as System.comPonentModel.icontainer
'Note: The following procedure is necessary to use the Windows Form Designer to modify this process using the Windows Form Designer. 'Don't modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System. Windows.Forms.Button Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents RichTextBox2 As System.Windows.Forms.RichTextBox < System.Diagnostics.DebuggerStepThrough ()> Private Sub InitializeComponent () Me.Button1 = New System.Windows.Forms.Button Me.RichTextBox1 = New System.Windows.Forms.RichTextBox Me.TextBox1 = New System.Windows.Forms.TextBox Me .Button2 = new system.windows.Forms.Button Me.Button3 = new system.windows.Forms.Button Me.TextBox2 = new system.windows.Forms.TextBox me.label1 = new System.Windows .Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.RichTextBox2 = New System.Windows.Forms.RichTextBox Me.SuspendLayout () '' Button1 'Me.Button1.Location = New System.Drawing.Point ( 288, 32) Me.Button1.name = "Button1" me.button1.size = new system.drawing.size (75, 32) me.button1.tabindex = 1 me.button1.text = "Send" '' richtextbox1 ' Me.richtextbox1.location = new system.drawing.point (24, 112) me.richtextbox1.name = "RichtextBox1" me.richtextbox1.size =
New System.Drawing.Size (208, 160) Me.RichTextBox1.TabIndex = 2 Me.RichTextBox1.Text = "RichTextBox1" '' TextBox1 'Me.TextBox1.Location = New System.Drawing.Point (64, 16) Me. TextBox1.name = "textbox1" me.textbox1.tabindex = 3 me.textbox1.text = "smtp.126.com" '' Button2 'me.button2.location = new system.drawing.point (384, 72) ME. Button2.name = "Button2" me.button2.tabindex = 4 me.button2.text = "Button2" '' Button3 'me.button3.location = new system.drawing.point (448, 40) me.button3.name = "Button3" me.button3.tabindex = 5 me.button3.text = "Button3" '' TextBox2 'me.textbox2.location = new system.drawing.point (64, 64) me.textbox2.name = "textbox2" ME .TextBox2.Tabindex = 6 me.textbox2.text = "25" '' Label1 'me.label1.location = new system.drawing.poi NT (8, 16) me.label1.name = "label1" me.label1.size = new system.drawing.size (40, 23) me.lawing.size (40, 23) me.label1.tabindex = 7 me.label1.text = "label1" '' Label2 'me.label2.location = new system.drawing.point (16, 64) me.label2.name = "label2" me.label2.size = new system.drawing.size (24, 23) me.label2.tabindex = 8 me.label2.text = "label2" '' richtextbox2 '
Me.RichTextBox2.Location = New System.Drawing.Point (280, 120) Me.RichTextBox2.Name = "RichTextBox2" Me.RichTextBox2.Size = New System.Drawing.Size (168, 152) Me.RichTextBox2.TabIndex = 9 Me.richtextBox2.text = "This is the content of the letter" '' Form1 'Me.Autoscalebasesize = new system.drawing.size (6, 14) me.clientsize = new system.drawing.size (592, 286) Me.Controls .Add (me.richtextbox2) me.controls.add (me.label2) me.controls.add (me.label1) me.controls.add (me.textbox2) me.controls.add (me.button3) me.controls .Add (me.button2) me.controls.add (me.textbox1) me.controls.add (me.richtextbox1) me.controls.add (me.button1) me.name = "Form1" me.text = "videocampture "Me.ResumeLayout (false) End Sub
#End Region Dim ipe As IPEndPoint Dim ip As IPAddress' ip = Dns.GetHostByName ( "smtp.126.com"). AddressList (0) Dim oNetworkStream As NetworkStream Dim oStreamReader As StreamReader Dim oStreamWriter As StreamWriter Dim bytes (43888) As Byte Dim B as Byte () Dim Client As TcpClient Dim Mail As New Socket (AddressFamily.internetwork, Sockettype.Stream, Protocoltype.tcp)
Function ReadFromnetStream (Byref NetStream As NetworkStream) AS String
Dim bb as byte () = new byte (521) {} NetStream.read (bb, 0, bb.length)
Dim read as string = system.text.encoding.utf8.getstring (bb) Return Read
END FUNCTION
Function WriteToNetStream (ByRef NetStream As NetworkStream, ByVal command As String) As String Dim stringToSend As String = command & vbCrLf Dim arrayToSend As Byte () = System.Text.Encoding.UTF8.GetBytes (stringToSend.ToCharArray) NetStream.Write (arrayToSend, 0, arrayToSend.Length) End FunctionSub sendmail (ByRef NetStream As NetworkStream, ByVal message As String) Dim arrayToSend As Byte () = System.Text.Encoding.UTF8.GetBytes (message.ToCharArray) NetStream.Write (arrayToSend, 0, arrayToSend .Ley (byval strmessage as string) AS string if strmessage.indexof (check) = -1 Then
Return "Error" Else: Return "Correct"
END IF
END FUNCTION
'/ ================================================ ==================== / -------------
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'ip = Dns.GetHostByName ( "smtp.126.com"). AddressList (0)' Dim i As Integer 'For i = 0 to 4 client = new TcpClient (TextBox1.text, int32.parse (textbox2.text)) Dim Stream As NetworkStream = Client.getStream () DIM COME AS STRING = ReadFromnetStream (stream)
RichtextBox1.AppendText ("Connection Promise:" & Come & VBCRLF) DIM CHECK AS STRING = CheckForerror (Come, "220")
While Check = "Error" Client.connect ("SMTP.126.com", 25) com = readfromnetStream (stream) me.richtextbox1.appendtext ("Connection Promise:" & com & vbcrlf) Check = CheckForerror (come, "220 ")
End while
DIM Hostname as string = dns.gethostname
WrittonetStream (Stream, "Ehlo" & Hostname)
COME = ReadFromnetStream (stream) RichtextBox1.AppendText ("Ehlo promise:" & com&) Check = CheckForerror (come, "250") DIM ROUND As INTEGER = 0
While Check = "Erro" 'And Round <5
Round = 1
WrittonetStream (Stream, "Ehlo" & Command ())
Come = readfromnetStream (stream) RichtextBox1.AppendText ("Ehlo promises:" & com& vbcrlf) Check = CheckForerror (com, "250")
End while '--------------------------------------- WrittonetStream (stream, "auth Login ")
Come = readfromnetStream (stream) RichtextBox1.AppendText ("Auth login promises:" & com "& vbcrlf) Check = CheckForerror (com," 334 ")
'--------------------------- WriteTonetStream (Stream, "WGSCD2008")' Note: Must be Base64 encoded user name com = readfromnetStream Stream) RichtextBox1.AppendText ("User Name Promise:" & Come & Vbcrlf) Check = CheckForerror (com, "334")
'-------------------------- WrittonetStream (stream, "********")' Note: must be Base64 encoded Password com = readfromnetStream (stream) RichtextBox1.AppendText ("Password promise:" & com& vbcrlf) Check = CheckForerror (come, "235") '-------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------- WrittonetStream (Stream, "Mail from: WGSCD2008@126.com") com = ReadfromnetStream (stream) RichtextBox1 .Appendtext ("Mail promises:" & com&) Check = CheckForerror (come, "250")
'------------------------------------- ----------------- WrittonetStream (Stream, "RCPT TO: WGSCD@126.com") COME = ReadFromnetStream (stream) RichtextBox1.AppendText ("RCPT to promise:" & come & vbcrlf) Check = Checkforerror (CHE, "250") '------------------------------------ ---------------------------------- WrittonetStream (stream, "data") com = readfromnetStream (stream) RichTextBox1 .Appendtext ("Data promises:" & com&) Check = CheckForerror (come, "354")
'------------------------------------- -------------------- WrittonetStream (Stream, "Subject: How are you wgscd?") 'WritetONETSTREAM (Stream, "HJHJHJHK" & VBCR & "TEST OK? Love you Ten Thousand years ") Dim b As Byte () = System.Text.Encoding.UTF8.GetBytes (RichTextBox2.Text.ToCharArray) Dim strmsg As String = System.Text.Encoding.UTF8.GetString (b) WriteToNetStream (stream, VBCR & "Test OK44" & strmsg & vbcrf & "." & VBCRLF) 'WritetONetStream (Stream, VBCR & "TEST OK44 loves you 10,000 years?" & vbcrlf & "." & vbcrlf)' com = readfromnetStream (stream) 'RichtextBox1.AppendText ("Data promises:" & com&)' Check = CheckForerror (CHE, "354")
'------------------------------------------' WritetONETSTREAM (Stream, "This is the experiment !!!" & vbcrf & "." & Vbrlf) 'com = readfromnetStream (stream)' RichtextBox1.AppendText ("Data promises:" & com& vbcrlf) 'Check = CheckForerror (come, "354")
'---------------------------
WrittonetStream (stream, "quit") come = readfromnetStream (stream) RichtextBox1.AppendText ("Send, server promises:" & com& vbcrlf) Check = CheckForerror (Come, "250")
'Next End Sub
'///
Sub sender1 ()
DIM COME AS STRING = "" "
DIM Check as string = "" "
Dim Stream As NetworkStream = Client.getStream
DIM Hostname as string = dns.gethostname
WriteToNetStream (stream, "EHLO" & hostName) come = ReadFromNetStream (stream) RichTextBox1.AppendText ( "EHLO promise:" & come & vbCrLf) check = checkForError (come, "250") Dim round As Integer = 0
While Check = "Erro" or round <5
Round = 1
WrittonetStream (Stream, "Ehlo" & Command ())
Come = readfromnetStream (stream) RichtextBox1.AppendText ("Ehlo promises:" & com& vbcrlf) Check = CheckForerror (com, "250")
End while
End Sub Private Sub Form1_Load (Byval E AS System.EventArgs) Handles MyBase.Load Dim Aa As Shapbse64.SBase64 Dim En as system.text.Encoding
AA = new shapbse64.sbase64 me.text = aa.encodingforstring ("000000000,000", en.default)
End Sub
Private sub button2_click (byval e as system.Object, byval e as system.eventargs) Handles Button2.Click Sender1 () End Subend Class