here is my code: ---------------------------------------------------------------
ID: 3624677 • Letter: H
Question
here is my code:-------------------------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim message As System.Net.Mail.MailMessage
Dim smtp As New System.Net.Mail.SmtpClient("smtp.live.com", 587)
message = New System.Net.Mail.MailMessage(TextBox1.Text, TextBox3.Text, TextBox4.Text, RichTextBox1.text)
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
smtp.Send(message)
MessageBox.Show("sent...")
Catch ex As Exception
MessageBox.Show("error")
End Try
End Sub
End Class
-------------------------------------------------------------------------
only the error MessageBox displayed
please help..!!!!!!!!!!
thanks
Explanation / Answer
Although not easy to ready, your code looks right. Do yourself a favor and rename your text boxes so you know what they're supposed to do. (fromTextBox, toTextBox, etc.) You are only showing an 'error' for your message. Change that to MessageBox.Show(ex.InnerException.ToString()) to see what error message is being returned and give you some idea of why you're failing. Can't remember if the Express editions include debugging, but if they do you can set a breakpoint and step through what's happening.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.