使用gmail smtp vb.net发送电子邮件

时间:2016-07-08 13:46:38

标签: vb.net email gmail

我想发送一封包含我的Gmail帐户的电子邮件,但我发现此错误并且发送的电子邮件已经发送! http://up.dev-point.com/uploads1/a75d55e308e91.png 我的代码是:

Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click


    Dim SmtpServer As New SmtpClient("smtp.gmail.com", 587)
    SmtpServer.Credentials = New Net.NetworkCredential("ihab@gmail.com", "pass")
    Dim mail As New MailMessage("ihab@gmail.com", "ihab@gmail.com", "New", "txt")
    SmtpServer.Send(mail)


End Sub 

1 个答案:

答案 0 :(得分:0)

请看这种情况,我认为您需要确保启用SSL并可能修改smtp访问的帐户设置。 Sending email through Gmail SMTP server with C#

如果您需要帮助将C#代码转换为vb.net,请告诉我