Discussion Locked

HTML-email with vb

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I would like to send an email in HTML-format with VB and smtp for example dimac's mail-component. How?

5 replies

by jay eckles

The simple answer is that you just markup the body of the email with HTML. The complicated answer is that you should create a MIME-multipart message, and include both the plain-text and the marked up versions of the message. I would actually go for the simple answer myself because 1. it's easier and 2. many email clients don't suppot multipart messages - mine will just attach the marked up version of the message as a seaparate htm file.

by ae_maillist

I tried to markup the body but it did not work... like this...

sbody = "" & _
"Message" & _
"" & _
"" & _
"From: Anders Eriksson [ae@aeit.com]
Sent: den 7 september" & _
"2001 10:11
To: ae@aeit.com
Subject: HTML
" & _
"
Test
" & _
"


 
" & _
""

by andrew

Are you using Windows 2000? If yes, then the following works nicely:
(set a reference to CDOSYS.DLL)

Dim oMessage As CDO.Message
Dim sBody As String

sBody = "From: Anders Eriksson [ae@aeit.com]
" & _
"Sent: den 7 september 2001 10:11
" & _
"To: ae@aeit.com
" & _
"Subject: HTML
" & _
"

" & _
"Test
" & _
"

 
"

Set oMessage = New CDO.Message
With oMessage
.HTMLBody = sBody
.To = "andrew@williamscomputing.com"
.From = "andrew@williamscomputing.com"
.Send
End With

This discussion is closed to new replies.