VB 2015 does not send the letter, throws out error:
Imports System.Net.Mail Public Class Form1 Dim Message As New MailMessage Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mail As New MailMessage() Dim SmtpServer As New SmtpClient SmtpServer.Credentials = New System.Net.NetworkCredential("otkogo@gmail.com", "xxxparolxxx") SmtpServer.Port = 587 SmtpServer.Host = "smtp.gmail.com" SmtpServer.EnableSsl = True mail.To.Add("komu@gmail.com") mail.From = New MailAddress("otkogo@gmail.com") mail.Subject = "this is a test mail" mail.Body = "some test body stuff" SmtpServer.Send(mail) End Sub End Class
ERROR:
Exception thrown: 'System.Net.Mail.SmtpException' in System.dll
Additional information: The SMTP server is required to authenticate. The server response was: 5.5.1 Authentication Required.