Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "CDOMail HTMLBody" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Reply « Previous Thread | Next Thread »
 
LinkBack Thread Tools Display Modes
  #1  
Old August 13th, 2008, 11:05 AM
PhloooooIsFlo's Avatar
Barn Newbie

 
Join Date: Jul 2008
Location: Indonesia
Posts: 32
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 1
PhloooooIsFlo is an unknown quantity at this point
Default CDOMail HTMLBody

Hi all, I need to know how to write the html page into CDOMail.HTMLBody.
Is the code below correct :
Code:
Mailer.HTMLBody =
			"<table width="743" height="476" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="28"></td>
					<td width="704" align="left" class="style1">
						<table width="704" height="30" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td width="100" align="left">Date</td>
								<td width="20" align="right"></td>
								<td align="left"><%=FormatDateTime(Date(),0)%></td>
							</tr>"
Thx
Reply With Quote
Sponsored Links
  #2  
Old August 13th, 2008, 11:23 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

You'll either have to double up all the double quotes inside the string or replace them with single quotes.

EDIT:::

here's a sample:
Code:
Mailer.HTMLBody = "<table width=""743"" height=""476"" border=""0"" cellpadding=""0"" cellspacing=""0""><tr><td width=""28""></td><td width=""704"" align=""left"" class=""style1""><table width=""704"" height=""30"" border=""0"" cellpadding=""0"" cellspacing=""0""><tr><td width=""100"" align='"left"">Date</td><td width="20" align="right"></td><td align=""left"">" & FormatDateTime(Date(),0) & "</td></tr>"
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
  #3  
Old August 13th, 2008, 11:24 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Hi flo,

i think it looks ok...does it give you an error?

only thing i do notice is...you don't have a close tag for table </table>.
Reply With Quote
  #4  
Old August 13th, 2008, 11:31 AM
PhloooooIsFlo's Avatar
Barn Newbie

 
Join Date: Jul 2008
Location: Indonesia
Posts: 32
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 1
PhloooooIsFlo is an unknown quantity at this point
Default

@ J : thx for the double quote

@ Belle : I haven't tried it yet, I just want to make sure if the code is written correctly

btw, does anyone know how to make it more simple? coz it will be a long html code T__T
Reply With Quote
  #5  
Old August 13th, 2008, 11:37 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

For long HTML strings, you can use concatenation to make it look more clean:

Code:
"<table>" & _
"<tr><td>Cell 1</td><td>Cell 2</td></tr>" & _
"</table>"
The ampersand (&) is for concatentation and the underscore (_) allows you to continue on the next line
Reply With Quote
The Following User Says Thank You to jmurrayhead For This Useful Post:
PhloooooIsFlo (August 13th, 2008)
  #6  
Old August 13th, 2008, 11:55 AM
PhloooooIsFlo's Avatar
Barn Newbie

 
Join Date: Jul 2008
Location: Indonesia
Posts: 32
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 1
PhloooooIsFlo is an unknown quantity at this point
Default

Awrite.. i will try this Hope it works tomorrow morning at work ^^
Reply With Quote
  #7  
Old August 13th, 2008, 10:40 PM
PhloooooIsFlo's Avatar
Barn Newbie

 
Join Date: Jul 2008
Location: Indonesia
Posts: 32
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 1
PhloooooIsFlo is an unknown quantity at this point
Default

Hi all, i'm having a problem with some asp code inside the html code i want to put into the HTMLBody... I confused how to write the code... for example :

Code:
"<table width='704'>"&_
          
          i = 1
          While Not rscart.EOF

          "<tr>"&_
                       "<td align='center' width='50' height='50'>" & i & "</td>"&_
                       "<td align='center' width='200' height='50'>"&_

                       strSQL = 'SELECT * FROM ProductCategory WHERE ProductCategoryID = ' & rscart('ProductCategory')
                       rss.Open strSQL, db, 3, 3

                       If Not rss.EOF Then Response.Write(rss('ProductCategoryName') & ' ') 
                       rss.Close

                       If rscart('ProductCategory') <> 17 Then
                       strSQL = 'SELECT * FROM ProductD WHERE ProductID = ' & rscart('ProductID') & ' AND ProductDID = ' & rscart('ProductDID')
                       rss.Open strSQL, db, 3, 3

                       If Not rss.EOF Then
                       Response.Write(rss('ProductName') & ' / ' & rss('ProductCode'))
                       If Trim(rss('ProductCodeDetail')) <> '' Then Response.Write('.' &  rss('ProductCodeDetail'))
                       If Trim(rss('Note')) <> '' Then Response.Write(' ' & rss('Note')) 
                       End If
                       rss.Close

                       Else

                       strSQL = 'SELECT * FROM OtherFabric WHERE FabricID = ' & rscart('ProductID')
                        rss.Open strSQL, db, 3, 3
                        
                        If Not rss.EOF Then
			Response.Write(rss('Folder') & ' ' & Trim(rss('FabricCode')))
                        End If
               
                       rss.Close
                       End If

                        "</td>"&_
Sorry i hv some more questions :
1. Is it possible to put both textBody and HTMLBody together? Coz i've tried this once and the body (content of the mail) is blank.
2. I've search about sending a page using HTMLBody, i put the code
Code:
Mailer.CreateMHTMLBody "http://www.xxxxxxxx.com/confirm.asp"
But the result is i got an error as below :
Microsoft VBScript compilation error '800a0401'

Expected end of statement

/thank_you.asp, line 113

Mailer.CreateMHTMLBody "http://www.xxxxxxxxxx.com/confirm.asp"
-----------------------^



Thx

Last edited by PhloooooIsFlo; August 14th, 2008 at 12:29 AM. Reason: add more question
Reply With Quote
  #8  
Old August 14th, 2008, 03:21 AM
micky's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: India
Posts: 101
Thanks: 10
Thanked 3 Times in 2 Posts
Rep Power: 1
micky is on a distinguished road
Default

sorry, i dont understand what u asking here??
u need to build a string, and honestly u write the code and see how it goes.

about putting both textBody and HTMLBody together, i really dont know.
have a look at this link, see if it helps
How do I send e-mail in HTML format?

regarding CreateMHTMLBody, it looks fine, u can see here
ASP Sending e-mail with CDOSYS

may be u shud post more code.
Reply With Quote
  #9  
Old August 14th, 2008, 03:25 AM
PhloooooIsFlo's Avatar
Barn Newbie

 
Join Date: Jul 2008
Location: Indonesia
Posts: 32
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 1
PhloooooIsFlo is an unknown quantity at this point
Default

Quote:
Originally Posted by micky View Post
sorry, i dont understand what u asking here??
u need to build a string, and honestly u write the code and see how it goes.

about putting both textBody and HTMLBody together, i really dont know.
have a look at this link, see if it helps
How do I send e-mail in HTML format?

regarding CreateMHTMLBody, it looks fine, u can see here
ASP Sending e-mail with CDOSYS

may be u shud post more code.
@Micky : So i have to separate the htmlMailer and ASPMailer?
Reply With Quote
  #10  
Old August 14th, 2008, 03:42 AM
micky's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: India
Posts: 101
Thanks: 10
Thanked 3 Times in 2 Posts
Rep Power: 1
micky is on a distinguished road
Default

Quote:
Originally Posted by PhloooooIsFlo View Post
@Micky : So i have to separate the htmlMailer and ASPMailer?
sorry, no idea what u asking here!!
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -4. The time now is 05:13 PM.



Content Relevant URLs by vBSEO 3.2.0