I am having a problem sending an email through my application.
This is what I have.
This is the exception.
This is what I have.
Imports System.Net.Mail
Public Class Form2
Dim EmailAddress As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If My.Settings.Register = False Then
Select Case MsgBox("Before you can save changes to Launcher Maker Elite you" & vbCrLf & "must register the program." & vbCrLf & vbCrLf & "Do you want to register Launcher Maker Elite?", MsgBoxStyle.YesNo, )
Case MsgBoxResult.Yes
EmailAddress = InputBox("Please enter the email address that the registration" & vbCrLf & "key will be sent to.")
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New System.Net.NetworkCredential("noreply.launchemrmakerelite@gmail.com", "***************")
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.Port = 587
SmtpServer.EnableSsl = True
mail.From = New MailAddress("noreply.launchermakerelite@gmail.com")
mail.To.Add(EmailAddress)
mail.Subject = "Launcher Maker Elite Registration"
mail.Body = "This is for testing SMTP mail."
SmtpServer.Send(mail)
Case (MsgBoxResult.No)
End Select
ElseIf My.Settings.Register = True Then
End If
End Sub
End Class
This is the exception.
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.