So I'm making a Program to Start/Restart/Stop and running commands from the Console for my Server.
Now when someone uses the console, I want to be alerted of it on my Mail.
I am using Visual Studio 2010.
This is my Code:
Dim mail As New MailMessage
Dim smtp As New SmtpClient
Try
mail.From = New MailAddress("mailwheretobealerted@testmail.com")
mail.To.Add("mailwheretobealerted@testmail.com")
mail.Subject = ("Text")
mail.Body = ("Some other Text")
Dim s As New SmtpClient("smtp.gmail.com")
s.Port = 587
s.EnableSsl = True
s.Credentials = New Net.NetworkCredential("Mailthatalerts@testmail.com", "password")
s.Send(mail)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Of course I hidden some of my personal informations but this is it, when I'm clicking on the button, I get THIS error:
The SMTP Server requires a secure connection or the client was not authenticated.
The server response was: 5.5.1 Authentification required. Learn more at
I have another Program that does the same on VB 2008, and it works fine.
Any help would be very appreciated.
Thank you in advance!