Connecting Tech Pros Worldwide Help | Site Map

CDO question -- generating email messages in HTML format

CB
Guest
 
Posts: n/a
#1: Nov 22 '05
CDO is perhaps the most obscure art in web programming, but I hope someone
would understand my issue. I have an ASP web application that needs to send
email messages in HTML format only -- there is no plain text version. The
messages are summaries of answers that people have input into an online
survey, and need to have a tabular form.

The following somewhat plausible code does not work:

dim OMsg
Set OMsg = Server.CreateObject("CDO.Message")
OMsg.Fields("urn:schemas:mailheader:return-path") = BounceEmail
OMsg.Fields("urn:schemas:mailheader:content-type") = "text/html"
OMsg.Fields.Update

The return path header is set as desired, but the content type header
stubbornly defaults to "text/plain". What is the secret to setting that
header?

I have seen lots of code examples on the MSDN site for setting the
content-type of body parts, but it seems needlessly complicated for my
situation and doesn't work on my system anyhow (unknown ProgID error). So I
was hoping to just set the message-level header to "text/html". (If I edit
one of the messages from my script in notepad, changing the header to
text/html by hand, it then is rendered correctly in email clients.)

Suggestions appreciated


AlanM
Guest
 
Posts: n/a
#2: Nov 22 '05

re: CDO question -- generating email messages in HTML format



"CB" <CB@discussions.microsoft.com> wrote in message
news:DC2A1B28-4885-4B06-BAF6-A93017392221@microsoft.com...[color=blue]
> CDO is perhaps the most obscure art in web programming, but I hope someone
> would understand my issue. I have an ASP web application that needs to
> send
> email messages in HTML format only -- there is no plain text version. The
> messages are summaries of answers that people have input into an online
> survey, and need to have a tabular form.
>
> The following somewhat plausible code does not work:[/color]


OMsg.HTMLBody = "your html"

I find that is all i have to do


[color=blue]
>
> dim OMsg
> Set OMsg = Server.CreateObject("CDO.Message")
> OMsg.Fields("urn:schemas:mailheader:return-path") = BounceEmail
> OMsg.Fields("urn:schemas:mailheader:content-type") = "text/html"
> OMsg.Fields.Update
>
> The return path header is set as desired, but the content type header
> stubbornly defaults to "text/plain". What is the secret to setting that
> header?
>
> I have seen lots of code examples on the MSDN site for setting the
> content-type of body parts, but it seems needlessly complicated for my
> situation and doesn't work on my system anyhow (unknown ProgID error). So
> I
> was hoping to just set the message-level header to "text/html". (If I
> edit
> one of the messages from my script in notepad, changing the header to
> text/html by hand, it then is rendered correctly in email clients.)
>
> Suggestions appreciated
>
>[/color]


Closed Thread