Last post Jun 03, 2019 01:49 AM by KathyW
May 31, 2019 10:04 AM|shsu|LINK
Below is my email in vb.net.I tried to use <br /> like this Attempt Number : " + attempt.Text + " <br /> Test Result : " + Result.Text + "" inside the e_mail.Body . But it is not working
Actually i want as below
Your sumbission was Successful
Test Date taken : 5/5/2019
Number : 1
Test Result : Pass
Ho wto update below email body to attain this. Appreciate the help
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.Port = 15
Smtp_Server.EnableSsl = False
Smtp_Server.Host = "10.100.10.1"
e_mail = New MailMessage()
e_mail.From = New MailAddress(emails)
e_mail.Subject = "Your sumbission was Successful."
e_mail.IsBodyHtml = False
e_mail.Body = "Your Test sumbission was Successful. Test Date taken : " + datetake.Text + " Attempt Number : " + attempt.Text + " <br /> Test Result : " + Result.Text + ""
Catch error_t As Exception
May 31, 2019 10:17 AM|Mikesdotnetting|LINK
You have caught any exceptions that might be raised then commented out the code that does anything with it. Therefore you are hiding the exception. You should remove the try-catch block while developing, so that exceptions are revealed. Once you have an
exception message, either google it to see if you can fix it yourself, or post it here.
Jun 02, 2019 01:07 PM|KathyW|LINK
<br /> is HTML. You have set e_mail.IsBodyHtml = False, so it will be treated as text.
Is that what you mean by "its not working?" (You should always explain what you mean by "its not working" when you post, explicitly telling us what you expect and what you get instead.)
If my guess is correct, set the IsBodyHtml = True, or use
for newlines in plain text emails
Jun 03, 2019 01:08 AM|shsu|LINK
There is no exception .
Your Test sumbission was Successful. \ r \ n Test Date taken : 6/3/2019 9:07:13 AM <br /> Attempt Number : 3 <br /> Test Result : Failed
mail is coming as above
Jun 03, 2019 01:49 AM|KathyW|LINK
I'm not sure what your post is supposed to say. For text, it is \r\n, not \ r \ n, and why do you still have <br /> if you are sending text rather than HTML? Pick one: text or HTML and set your mail body accordingly.