PDA

View Full Version : Using a html document in CDONTS mail


Mhtml
10-10-2002, 03:55 AM
How can I send text/html CDONTS or any component in that case mail? I'd like to be able to send a html newsletter, do I put in an enctype or mimetype or something somewhere in my code?

A tutorial would be good, I can only find ones that support text.

whammy
10-10-2002, 04:59 AM
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = ""
objMail.From = ""
objMail.cc = ""
objMail.bcc = ""
'objMail.mailFormat = 0 'This is for HTML
'objMail.bodyFormat = 0 'This is for HTML

MessageBody = "" & CHR(13)
MessageBody = MessageBody & "" & CHR(13)

objMail.Subject = ""
objMail.Body = MessageBody
objMail.Send
Set objMail = Nothing

There you go... uncomment the commented lines, and your message will be sent as HTML.

If you want to send an HTML document, then just use Scripting.FileSystemObject to read the document itself (it doesn't matter if it's a text file or an HTML file) and make that your message body.

If you need more info, I can send you an example that I use to email an HTML page to a list. :D

Mhtml
10-10-2002, 05:20 AM
Thanks, lol. You are on a roll today. I understand it completely. FSO is my friend!
:)