Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 10th, 2008, 02:56 PM
Familiar Sight
 
Join Date: Oct 2006
Posts: 142
Default Table in a HTML mail

Hi,

I'm trying to send a table in my e-mail but having problems with the " and '

I don't know ASP so please tel mehow do I fix this probles.

here is what I want to do (piece of the code), The problem is with the width and border's " ".

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

Expand|Select|Wrap|Line Numbers
  1. myMail.HTMLBody = "<table width="400" border="1">
  2.   <tr>
  3.     <td>sample text</td>
  4.     <td>sample text</td>
  5.   </tr>
  6.   <tr>
  7.     <td>sample text</td>
  8.     <td>sample text</td>
  9.   </tr>
  10. </table>"

Last edited by DrBunchman; September 11th, 2008 at 08:47 AM. Reason: Added [Code] Tags - Please use the '#' button
Reply
  #2  
Old September 11th, 2008, 08:53 AM
DrBunchman's Avatar
Moderator
 
Join Date: Jan 2008
Location: Winchester, UK
Posts: 924
Default

Hi webandwe,

Inside a string (which is delimited by double quotes) you can use single quotes to mark the beginning and end of html properties. Also, it is easier to build your html body as a string variable and then assign that to the mail object property.

Here's an example using your code above:

Expand|Select|Wrap|Line Numbers
  1. Dim sBody
  2. sBody = "<table width='400' border='1'>"
  3. sBody = sBody & "<tr>"
  4. sBody = sBody & "<td>sample text</td>"
  5. sBody = sBody & "<td>sample text</td>"
  6. sBody = sBody & "</tr>"
  7. sBody = sBody & "</table>"
  8.  
  9. myMail.HTMLBody =  sBody
Does this make sense? Let me know,

Dr B
Reply
  #3  
Old September 11th, 2008, 09:07 AM
omerbutt's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 227
Default

Quote:
Originally Posted by DrBunchman
Hi webandwe,

Inside a string (which is delimited by double quotes) you can use single quotes to mark the beginning and end of html properties. Also, it is easier to build your html body as a string variable and then assign that to the mail object property.

Here's an example using your code above:

Expand|Select|Wrap|Line Numbers
  1. Dim sBody
  2. sBody = "<table width='400' border='1'>"
  3. sBody = sBody & "<tr>"
  4. sBody = sBody & "<td>sample text</td>"
  5. sBody = sBody & "<td>sample text</td>"
  6. sBody = sBody & "</tr>"
  7. sBody = sBody & "</table>"
  8.  
  9. myMail.HTMLBody =  sBody
Does this make sense? Let me know,

Dr B
of course you should use this technique to concatinate the table into the mail body ....this is the more managed and precised method any one can tell what the code is doing by just a glimpse of it.
Reply
  #4  
Old September 11th, 2008, 01:05 PM
Familiar Sight
 
Join Date: Oct 2006
Posts: 142
Default

Hi,

Thanks I'll do it that way. In PHP I created the table, paste and swap the ' " around.

The reason I ask was because I have one huge form. 101 fields. (really 101).

Thanks all.
Reply
  #5  
Old September 12th, 2008, 07:16 AM
omerbutt's Avatar
Familiar Sight
 
Join Date: Nov 2006
Posts: 227
Default

Quote:
Originally Posted by webandwe
Hi,

Thanks I'll do it that way. In PHP I created the table, paste and swap the ' " around.

The reason I ask was because I have one huge form. 101 fields. (really 101).

Thanks all.
sure webandwe,
you are welcome any time :)
regards,
Omer Aslam
Reply
Reply

Bookmarks

Thread Tools

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 Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles