I am using VS 2012 Express on a Win 8 computer.
I can't get the HTML coding to work in the ".Body" portion of the Email code shown below. No formatting or spacing etc. Works fine in the commented out Text version of the Body. What am I doing wrong?????????
Thanks for your help!!
Private Sub ButtonEmail_Click(sender As Object, e As EventArgs) Handles ButtonEmail.Click
Try
Cursor = Cursors.WaitCursor
Dim mail As New MailMessage()
With mail
.From = New MailAddress("drj@embarqmail.com")
.To.Add("drj@embarqmail.com")
.Subject = "Tester Email"
.Body = <html><body><p><strong>Hello to you</strong></p><br></br><p>Time for bed</p></body></html>
.IsBodyHtml = True
'.Body = "Hello to you" _
' & vbCrLf & vbCrLf & "Hello to you too!!"
End With
Dim smtpEmail As New Mail.SmtpClient
With smtpEmail
.Credentials = New Net.NetworkCredential("drj@embarqmail.com", "qq7d")
.Port = 25
.Host = "smtp.embarqmail.com"
.Send(mail)
Cursor = Cursors.Default
MsgBox("Email Sent")
End With
Catch ex As Exception
Beep()
MsgBox("Problem Sending Email: " & ex.Message)
End Try
End Sub
I can't get the HTML coding to work in the ".Body" portion of the Email code shown below. No formatting or spacing etc. Works fine in the commented out Text version of the Body. What am I doing wrong?????????
Thanks for your help!!
Private Sub ButtonEmail_Click(sender As Object, e As EventArgs) Handles ButtonEmail.Click
Try
Cursor = Cursors.WaitCursor
Dim mail As New MailMessage()
With mail
.From = New MailAddress("drj@embarqmail.com")
.To.Add("drj@embarqmail.com")
.Subject = "Tester Email"
.Body = <html><body><p><strong>Hello to you</strong></p><br></br><p>Time for bed</p></body></html>
.IsBodyHtml = True
'.Body = "Hello to you" _
' & vbCrLf & vbCrLf & "Hello to you too!!"
End With
Dim smtpEmail As New Mail.SmtpClient
With smtpEmail
.Credentials = New Net.NetworkCredential("drj@embarqmail.com", "qq7d")
.Port = 25
.Host = "smtp.embarqmail.com"
.Send(mail)
Cursor = Cursors.Default
MsgBox("Email Sent")
End With
Catch ex As Exception
Beep()
MsgBox("Problem Sending Email: " & ex.Message)
End Try
End Sub