【问题标题】:VB.NET SMTP gmail not workingVB.NET SMTP gmail 不工作
【发布时间】:2015-04-25 02:33:10
【问题描述】:

我不断收到此错误消息 任何解决方案?

"smtp 服务器需要安全连接或客户端未通过身份验证 5.5.1"

Public Sub SendCode()

    GenerateCode()

    Dim Mail As New MailMessage
    Dim SMTPServer As New SmtpClient("smtp.gmail.com")
    Try
        SMTPServer.Credentials = New  _
       Net.NetworkCredential("email@gmail.com", "password")
        Mail.From = New MailAddress("email@gmail.com")
        Mail.To.Add("email2@gmail.com")
        Mail.Subject = "Confirmation Code"
        Mail.Body = Me.Firstname & " " & Me.LastN & " This is a NO_REPLY confirmation Email, Confirmation Code:" & Me.ConfirmationCode & ""
        SMTPServer.Port = 587
        SMTPServer.EnableSsl = True
        SMTPServer.Send(Mail)
        MsgBox("mail sent")
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub

【问题讨论】:

    标签: vb.net smtp gmail


    【解决方案1】:

    您需要将端口设置为 465,并将 SSL/TLS 设置为自动...

    我已成功使用此代码...https://www.emailarchitect.net/easendmail/kb/vbnet.aspx?cat=2

    【讨论】:

      猜你喜欢
      • 2016-08-14
      • 2017-12-30
      • 1970-01-01
      • 2014-12-08
      • 1970-01-01
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多