0
我不斷收到此錯誤消息 任何解決方案?VB.NET SMTP gmail不工作
「SMTP服務器要求安全連接或客戶端沒有經過認證5.5.1」
公用Sub SendCode()
GenerateCode()
Dim Mail As New MailMessage
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
Try
SMTPServer.Credentials = New _
Net.NetworkCredential("[email protected]", "password")
Mail.From = New MailAddress("[email protected]")
Mail.To.Add("[email protected]")
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