VB.Net Windows アプリケーション (VS 2010) で電子メールを送信しようとしていますが、
SMTP ホストが見つかりません
私のコードは以下の通りです、
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("mymailid@gmail.com", "mypassword")
SmtpServer.Port = 25
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
Dim addr() As String = TextBox1.Text.Split(",")
Try
mail.From = New MailAddress("mymailid@gmail.com", "Developers", System.Text.Encoding.UTF8)
Dim i As Byte
For i = 0 To addr.Length - 1
mail.To.Add(addr(i))
Next
mail.Subject = TextBox3.Text
'mail.Body = TextBox4.Text
If ListBox1.Items.Count <> 0 Then
For i = 0 To ListBox1.Items.Count - 1
mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i)))
Next
End If
SmtpServer.SendAsync(mail, mail.Subject)