Solved

HTML Mail with cdonts vb asp

Posted on 2000-03-22
3
339 Views
Last Modified: 2008-02-26
I am trying to use the following code to send HTML format mail, but I get cdoBodyFormatHTML variable undefined.  Sending regular text (without the bodyformat) works fine.

Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = "don@bbb.com"
objMail.From = "donb@bbb.net"
objMail.Subject = "Test Message"
objMail.BodyFormat = cdoBodyFormatHTML
objMail.Body = msg
objMail.Send
Set objMail = Nothing

msg is HTML
0
Comment
Question by:donb1
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
rmullins earned 50 total points
ID: 2647779
It is undefined unless you did a server side include for a file that has that constant defined.

cdoBodyFormatHTML is referred to in the documentation if you use constants. In this case, if you look at your code, it is simply a variable that is undefined.

The easiest (although not the most readable) would be to replace:
"objMail.BodyFormat = cdoBodyFormatHTML"
with
"objMail.BodyFormat = 0" (zero, not the letter)

Alternatively, you could declare constants either on the page or in an include file.
An example that you could use is:
"Const cdoBodyFormatHTML = 0"

As a side note, make sure you have the SMTP Service running when you execute this.

Happy mailing,
-- Rob --
0
 

Author Comment

by:donb1
ID: 2662670
Thanks
0
 
LVL 3

Expert Comment

by:rmullins
ID: 2665080
You are very welcome. :-)
-- Rob --
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now