m0tSiE
asked on
Send email via VB.net in HTML form?
Hi,
I have setup a form to send emails via Outlook and the emails are sent containing just text.
However, I want to send these emails containing HTML. Can anyone show me how I can set the below code to send the emails in HTML form?
Thanks,
Paul
I have setup a form to send emails via Outlook and the emails are sent containing just text.
However, I want to send these emails containing HTML. Can anyone show me how I can set the below code to send the emails in HTML form?
Thanks,
Paul
Public Class Form1
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon()
OutMail = OutApp.CreateItem(0)
strbody = "<html><body><font color='red'>TEXT</font></b></body></html>" & _
"Dear all," & vbNewLine & vbNewLine & _
"This is a test email." & vbNewLine & _
"" & vbNewLine & _
"" & vbNewLine & _
"Thanks and regards," & _
"" & vbNewLine & _
"Paul"
End Sub
Private Sub SendClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendClose.Click
Dim DestinationEmail As String
Dim RequestNumber As String
RequestNumber = RequestNo.Text
DestinationEmail = SendTo.Text
With OutMail
.To = DestinationEmail
.CC = ""
.BCC = ""
.Subject = "DWP Service Desk - 4 DAY CLOSE - <" & RequestNumber & "> - chkd"
.Body = strbody
.send()
MessageBox.Show("Email Sent!")
'Clear Text Boxes
SendTo.Text = ""
RequestNo.Text = ""
LocationCode.Text = ""
Subject.Text = ""
End With
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, worked great! :D
You are welcome
http://www.outlookcode.com/d/code/htmlimg.htm