Imports System.Web
Imports System.IO
Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim num As Integer = 0
For intLoopIndex = 0 To Convert.ToInt32(TextBox5.Text)
Dim mail As New MailMessage
Dim SmtpServer As New SmtpClient
SmtpServer.Credentials = New Net.NetworkCredential(TextBox3.Text, TextBox4.Text)
SmtpServer.Port = 465
SmtpServer.Host = "smtp-relay.gmail.com"
SmtpServer.EnableSsl = False
If ComboBox1.SelectedItem = "AT&T" Then
mail.To.Add(TextBox1.Text + "@txt.att.net")
mail.From = New MailAddress(TextBox3.Text)
mail.Subject = TextBox2.Text
mail.Body = RichTextBox1.Text
SmtpServer.Send(mail) '<-- times out here
ElseIf ComboBox1.SelectedItem = "7-11 Speakout" Then
mail.To.Add(TextBox1.Text + "@cingularme.com")
mail.From = New MailAddress(TextBox3.Text)
mail.Subject = TextBox2.Text
mail.Body = RichTextBox1.Text
SmtpServer.Send(mail) '<-- times out here
End If
num = num + 1
Label1.Text = num
Next intLoopIndex
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Process.Start("http://www.fonefinder.net/")
End Sub
End Class
当我运行此代码时,我在尝试发送电子邮件时收到错误消息。当我运行程序时,我得到一个通用的超时错误,例如,Verizon。我正在使用GMail帐户的正确登录详细信息,我已经尝试了我在网上找到的每个修复程序。它适用于我拥有的每个运营商(邮件服务器)。