|
VB 8 Script Problem Email Program?
I have Visual Basic 2008 and I am trying to write a program that Emails me. I have 2 textboxes and a send button and YES all of the names are correct. Every time I debug it though, it gives me the "Not Successful" error message I wrote. What is wrong with it?
Here is the script:
Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyMailMessage As New MailMessage()
Try
MyMailMessage.From = New MailAddress("example@gmail.com")
MyMailMessage.To.Add("basketmaster33@yahoo.ca")
MyMailMessage.Subject = TextBox1.Text
MyMailMessage.Body = TextBox2.Text
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("example@Gmail.com", "example23")
SMTP.Send(MyMailMessage)
TextBox2.Text = ""
MsgBox("Email Was Succesful", MsgBoxStyle.Information, "Information")
Catch ex As Exception
MsgBox("Not Succesful")
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Thanks. All help will be appreciated, and anyone who actually finds the problem gets Best Answer!
The ... after @Gm Is really :
ail.com",
So please don't try to tell me that that is the mistake!
|