I have a problem trying to make the user of my program send an Email to my Gmail account, this my Setup:
And this is my code:
Imports System.Net.Mail
Public Class Form1
Private Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles txtBody.TextChanged
    lblCharCount.Text = String.Format("Letter Count: {0}", txtBody.Text.Length)
End Sub
Private Sub btnSend_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSend.Click
    If YourEmailTextBox.Text <> "" AndAlso txtBody.Text <> "" Then
        Dim message As New MailMessage
        Dim smtp As New SmtpClient
        message.To.Add(YourEmailTextBox.Text.Trim())
        message.From = New MailAddress(YourEmailTextBox.Text, "heading")
        message.Subject = txtSubject.Text
        message.Body = txtBody.Text
        smtp.Host = "smtp.gmail.com"
        smtp.Port = "587"
        smtp.EnableSsl = True
        smtp.Credentials = New Net.NetworkCredential("MyGmailAccount@gmail.com", "MyPassword")
        Try
            smtp.Send(message)
            MsgBox("your message has been sent")
        Catch ex As Exception
            MsgBox(ex.Message)
            Exit Sub
        End Try
    Else
        MsgBox("Please enter a message into the body and the email address of the recipient", MsgBoxStyle.Information)
    End If
End Sub
End Class
And this is the problem :
Some help Please...


 
     
    