navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

CDONTS HTML formatting

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> CDONTS HTML formatting
Page: [1]
 
helensnow

 

Posts: 228
Joined: 12/18/2003
Status: offline

 
CDONTS HTML formatting - 7/12/2004 17:39:55   
Hello

I have setup a CDONTS mail report from my web site. It works fine. However I want to format the report as an HTML report.

So I did this:

NewMail.BodyFormat = 0
NewMail.MailFormat = 0


Then I copied HTML code from my "FrontPage" page and did a copy and paste into my access database. So it should be formatted perfectly.

However, when I receive the report sent from the web site it is not interpreting the HTML, I just get the HTML code. Am I missing someting that makes the HTML code execute once it is received as e-mail?

example of what I get back

<html> <head> <title>Report Page</title> </head> <body> <div> <div> <font face="Arial" size="2" ...Blar Blar Blar


Summer of Helen
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: CDONTS HTML formatting - 7/12/2004 20:40:36   
Your mail client supports HTML mail?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to helensnow)
helensnow

 

Posts: 228
Joined: 12/18/2003
Status: offline

 
RE: CDONTS HTML formatting - 7/12/2004 20:47:34   
Hi

Yes it does support HTML mail, I am using outlook express

H.

(in reply to Spooky)
helensnow

 

Posts: 228
Joined: 12/18/2003
Status: offline

 
RE: CDONTS HTML formatting - 7/12/2004 21:05:19   
Hi
I have just created a Access memo field using teh DRW/DIW.

So I can easily paste in the HTML from FrontPage. What I noticed is that when I do a response.write on the CDONTS page to view what I am about to e-mail, it too is straight code (not executed)

I was wondering if it has something to do with datafield types, as all the CR/LF data is lost as it appears as a long string

Example below
<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 2</title> </head> <body> <p><font color="#800080" size="6"><b>Hello World</b></font></p> </body> </html>

Helen

(in reply to helensnow)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: CDONTS HTML formatting - 7/12/2004 22:14:39   
Whats the full email script?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to helensnow)
helensnow

 

Posts: 228
Joined: 12/18/2003
Status: offline

 
RE: CDONTS HTML formatting - 7/13/2004 8:09:36   
Hi here is the script minus the usual DRW code above

<%
Dim NewMail, strFilePath

Set NewMail = Server.CreateObject("CDONTS.NewMail")

NewMail.Importance = 1
NewMail.BodyFormat= 0
NewMail.MailFormat = 0

NewMail.From = FP_FieldVal(fp_rs,"FromEmail")

NewMail.To = FP_FieldVal(fp_rs,"email")

NewMail.Subject = "Test Message"

NewMail.Body = FP_FieldVal(fp_rs,"MessageBody")

NewMail.Send()

Set NewMail = Nothing

%>

(in reply to Spooky)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: CDONTS HTML formatting - 7/13/2004 14:06:37   
Use this :

NewMail.Body = FP_Field(fp_rs,"MessageBody")

Otherwise itll format the code

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to helensnow)
Jessop

 

Posts: 6
Joined: 7/12/2004
Status: offline

 
RE: CDONTS HTML formatting - 7/13/2004 14:08:53   
Hellensnow,

This is what I have done in the past hope it helps:

<%

dim objMail
dim HTML

Set objMail = Server.CreateObject("CDO.Message")

HTML = HTML & " <html><body>"
HTML = HTML & " <table border=""0"">"
HTML = HTML & " <tr rowspan=""2"">"
HTML = HTML & " <td colspan=""2"">"
HTML = HTML & " </td>"
HTML = HTML & " </tr>"
HTML = HTML & " <tr>"
HTML = HTML & " <th bgcolor=""#B0CDDD"">"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2""> <b> Contact Name: </b> </font> </p>"
HTML = HTML & " </th>"
HTML = HTML & " <td>"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2"">" & Request("ContactName") & "</p>"
HTML = HTML & " </td>"
HTML = HTML & " </tr>"
HTML = HTML & " <tr>"
HTML = HTML & " <th bgcolor=""#B0CDDD"">"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2""> <b> Contact Phone: </b> </font> </p>"
HTML = HTML & " </th>"
HTML = HTML & " <td>"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2"">" & Request("ContactPhone") & "</p>"
HTML = HTML & " </td>"
HTML = HTML & " </tr>"
HTML = HTML & " <tr>"
HTML = HTML & " <th bgcolor=""#B0CDDD"">"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2""> <b> Contact Email: </b> </font> </p>"
HTML = HTML & " </th>"
HTML = HTML & " <td>"
HTML = HTML & " <p style=""margin-top:1;margin-bottom:1"" align=""left""> <font face=""arial"" size=""2"">" & Request("ContactEmail") & "</p>"
HTML = HTML & " </td>"
HTML = HTML & " </tr>"
HTML = HTML & " </table>"
HTML = HTML & "<br>"
HTML = HTML & " </body></html>"

objMail.From = "Sombody@Somewhere.com"
objMail.Subject = Request("RegType")
objMail.CC = Request("ContactEmail") & "; " & "SomebodyAgain@Somewhere.com"
objMail.BodyPart.ContentTransferEncoding = "quoted-printable"
objMail.HTMLBody = HTML
objMail.To = Request("ManagerEmail")
objMail.Send

set objMail = Nothing

set HTML = Nothing

%>

The objmail.BodyPart.ContentTransferEncoding = "quoted-printable" is important if you are using IIS6 there is a change between IIS5 an IIS6 where you will eventually get a ! mark in your string if you go over a certain length. This was darn near impossible to troubleshoot. I ended up having to call MS to get help from their engineers.

Let me know if you need more information

Here is a copy of the email from the issue and resolution I had in case your interested.

-------------------------------------------------------------------------------------------------------------------

ISSUE:
=======
Customer using CDOSYS to send HTML mail and getting exclamation mark ! at or after every 991st character. The application worked fine on Windows 2000 but gives this problematic behavior on Windows 2003.

RESOLUTION/STEPS TAKEN:
====================

This is due to the fact that Windows 2003 CDOSYS by default uses 7 bit ecoding as content transfer encoding. For content with multiple lines we need quoted-printable encoding.


In the latest modification version sent to customer I used :

objCDO.BodyPart.ContentTransferEncoding = "quoted-printable"
objCDO.HTMLBody = myHTMLBody

The later one (which worked) is the correct way to set encoding. The previous method only works for TextBody but does not work for HTMLBody. So setting
objCDO.BodyPart.ContentTransferEncoding = "quoted-printable" resolved the issue.

Here are some links on Content Transfer Encoding
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_cdosys_content-transfer-encoding.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_ibodypart_contenttransferencoding.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_ibodypart_contenttransferencoding.asp>
Please visit msdn.microsoft.com and support.microsoft.com and search on contenttransferencoding or content-transfer-encoding for more information.


The difference is in cdosys.dll version on Windows 2000 and Windows 2003 rather than II S 5.0 and IIS 6.0. In Windows 2000 version the default encoding used was quoted-printable but on Windows 2003 version of cdosys.dll the default content transfer encoding was changed to 7-bit. Hence applications needing quoted-printable have to explicitly set content transfer encoding to "quoted-printable" in the code.


Good Luck and have a great day.

AJ

(in reply to helensnow)
wmleonar

 

Posts: 1
Joined: 11/18/2004
Status: offline

 
RE: CDONTS HTML formatting - 11/18/2004 15:36:19   
Just wanted to say thanks to Jessop for posting the fix for the exclimation mark issue, it took me nearly a day to find this solution, this was a tough one. Thanks! -Will

(in reply to helensnow)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: CDONTS HTML formatting - 11/18/2004 16:39:51   
Note however, that is a different issue as we were discussing CDONTS and not CDOSYS

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to wmleonar)
Giomanach

 

Posts: 6112
Joined: 11/19/2003
From: England
Status: offline

 
RE: CDONTS HTML formatting - 11/19/2004 7:33:06   
Helen

This is what I've used for CDONTS without failure:

quote:


strEmail=Request.Form("txtEmail")
Dim MyCDONTSMail2
Dim HTML
Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Message From Web</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor='#FFFFFF'>"
HTML = HTML & "<p><font size ='2' face='Verdana, Tahoma, Arial, Sans-serif'><strong>"
HTML = HTML & "Title</strong> - "
HTML = HTML & "Title</p>"
HTML = HTML & "<p>Message Body</p>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
MyCDONTSMail2.From= strEmail
MyCDONTSMail2.To="mail@you.com"
MyCDONTSMail2.Subject="Message From Web"
MyCDONTSMail2.BodyFormat=0
MyCDONTSMail2.MailFormat=0
MyCDONTSMail2.Body=HTML
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing


Alter to suit:)

_____________________________




(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> CDONTS HTML formatting
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts