Member Avatar

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
            mail.From = New MailAddress("")


            mail.Subject = ("Text")

            mail.Body = ("Some other Text")

            Dim s As New SmtpClient("")

            s.Port = 587

            s.EnableSsl = True

            s.Credentials = New Net.NetworkCredential("", "password")


        Catch ex As Exception
        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!

    Dim SmtpServer As New SmtpClient()
    Dim mail As New MailMessage()
    SmtpServer.Credentials = New Net.NetworkCredential("", "abc123def")
    SmtpServer.Port = 25
    SmtpServer.Host = ""
    mail = New MailMessage()
    mail.From = New MailAddress("")
    mail.Subject = "Testing"
    mail.Body = subject
    MsgBox("mail sent sucessfully")

Ur connections are correct...try putting ur credentials at first...the above code works for me.....