omega
omega

Reputation: 43893

How to use html in asp classic email object body?

I want to use html in my email body in my classic asp code. This is code:

Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = "[email protected]"
objCDO.From = "[email protected]"
objCDO.Subject = "Test Subject"
objCDO.Body = "<html><head></head><body><b>There has been a change.</b></body></html>"
objCDO.Send

However when I view the email, the body looks exactly like this string, with all the tags. I want the tags to be rendered and make the text bold.

Does anyone know whats wrong?

Thanks.

Upvotes: 0

Views: 1176

Answers (1)

John
John

Reputation: 4663

If you're using CDONTS then you need to add another couple of parameters to your object

objCDO.BodyFormat=0
objCDO.MailFormat=0

See this link http://support.microsoft.com/kb/189945

That said, CDOSYS was introduced on Win 2000 and CDONTS was removed completely from Win 2003, so I recommend you use CDOSYS, (unless you're on a really old NT box). Creating HTML emails is also rather easier

The w3schools tutorial is quite good http://www.w3schools.com/asp/asp_send_email.asp

Upvotes: 1

Related Questions