General discussion

Locked

HTML-email with vb

By ae_maillist ·
I would like to send an email in HTML-format with VB and smtp for example dimac's mail-component. How?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

HTML-email with vb

by Jay Eckles In reply to HTML-email with vb

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.

Collapse -

HTML-email with vb

by ae_maillist In reply to HTML-email with vb

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

sbody = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & _
"<HTML><HEAD><TITLE>Message</TITLE>" & _
"<META http-equiv=Content-Type content=""text/html; charset=iso-8859-1"">" & _
"<META content=""MSHTML 6.00.2600.0"" name=GENERATOR></HEAD>" & _
"<BODY><B>From:</B> Anders Eriksson [ae@aeit.com]<BR><B>Sent:</B> den 7 september" & _
"2001 10:11<BR><B>To:</B> ae@aeit.com<BR><B>Subject:</B> HTML<BR>" & _
"<DIV><!-- Converted from text/plain format --><FONT color=#ff0000><FONT" & _
"face=Arial size=7><STRONG>Test</STRONG></FONT></FONT></DIV>" & _
"<DIV><FONT color=#ff0000><FONT face=Arial size=2></FONT><FONT face=Arial" & _
"size=2></FONT><BR></FONT><BR> </DIV>" & _
"</BODY></HTML>"

Collapse -

HTML-email with vb

by andrew In reply to HTML-email with vb

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 = "<B>From:</B> Anders Eriksson [ae@aeit.com]<BR>" & _
"<B>Sent:</B> den 7 september 2001 10:11<BR>" & _
"<B>To:</B> ae@aeit.com<BR>" & _
"<B>Subject:</B> HTML<BR>" & _
"<DIV><!-- Converted from text/plain format --><FONT color=#ff0000 face=Arial size=7>" & _
"<STRONG>Test</STRONG></FONT></DIV>" & _
"<DIV><BR> </DIV>"


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

Collapse -

HTML-email with vb

by ae_maillist In reply to HTML-email with vb

Poster rated this answer

Collapse -

HTML-email with vb

by ae_maillist In reply to HTML-email with vb

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums