Emailing Form Results in HTML

R

Rob

Hi,

I have a form (it works fine) but what I want to do is email the form
exactly as it is with the populated information. In otherwords, I want the
email sent to look just like the form that was filled out. I was able to get
it close but the problem I am having is that the form has a table in it and
the table uses a background JPG; but for some reason image is not being
included in the email and I'm stumped as to how to get it in there where it
belongs.

Here's the code I am using in the email function/sub.....

CODE:

Set msgMail=CreateObject("CDO.Message")
msgMail.From = Request("email")
msgMail.To = "(e-mail address removed)"
msgMail.Subject = "Response To Request"
msgMail.HTMLBody = " <html><head> " & _
"<style type=""text/css"">" & _
"<!--" & _
".TextBox {border: #000000 1px inset;border-color: #000000 #000000
#000000 #000000;font-family: Arial, sans-serif;font-size: 12px;color:
#000000;}" & _
"-->" & _
"</style></head><body>" & _

"***********************************************************************************<br>" & _
"<table
style="background-image:url('table_background.jpg');background-repeat:no-repeat;font-family:Arial;font-size:10pt;font-weight:bold;color:#000000;"
width=""703"" height=""490"" border=""0"" cellpadding=""0""
cellspacing=""0"">" & _
"<tbody><tr height=""130""><td> </td></tr><tr><td align=""center"">" & _
"<table
Style=""font-family:Arial;font-size:10pt;font-weight:bold;color:#000000;""
width=""650"" border=""0"" cellpadding=""0"" cellspacing=""0""><tbody>" & _
"<tr><td align=""left"" width=""100""> First Name:</td><td align=""left"">
<input class=""TextBox"" type=""text"" id=""Fname"" name=""Fname""
size=""29"" value=""" & Request("Fname") & """ readonly
tabindex=""1""></td><td align=""left"" width=""100""> Last Name:</td><td
align=""left""> <input class=""TextBox"" type=""text"" id=""lname""
name=""lname"" size=""29"" value=""" & Request("lname") & """ readonly
tabindex=""2""></td></tr>" & _
"<tr><td align=""left"" width=""100""> Company:</td><td align=""left"">
<input class=""TextBox"" type=""text"" id=""company"" name=""company""
size=""29"" value=""" & Request("company") & """ readonly
tabindex=""3""></td><td align=""left"" width=""100""> Business
Title:</td><td align=""left""> <input class=""TextBox"" type=""text""
id=""co_title"" name=""co_title"" size=""29"" value=""" & Request("co_title")
& """ readonly tabindex=""4""></td></tr>" & _
"<tr><td align=""left"" width=""100""> Address:</td><td align=""left"">
<input class=""TextBox"" type=""text"" id=""address1"" name=""address1""
size=""29"" value=""" & Request("address1") & """ readonly
tabindex=""5""></td><td align=""left"" width=""100""> Address Cont.:</td><td
align=""left""> <input class=""TextBox"" type=""text"" id=""address2""
name=""address2"" size=""29"" value=""" & Request("address2") & """ readonly
tabindex=""6""></td></tr>" & _
"<tr><td align=""left"" width=""100""> City:</td><td align=""left"">
<input class=""TextBox"" type=""text"" id=""city"" name=""city"" size=""29""
value=""" & Request("city") & """ readonly tabindex=""7""></td><td
align=""left"" width=""100""> State:</td><td align=""left""> <input
class=""TextBox"" type=""text"" id=""state"" name=""state"" size=""29""
value=""" & Request("state") & """ readonly tabindex=""7""></td></tr>" & _
"<tr><td align=""left"" width=""100""> Zip:</td><td align=""left""> <input
class=""TextBox"" type=""text"" id=""zip"" name=""zip"" size=""29"" value="""
& Request("zip") & """ readonly tabindex=""9""></td><td align=""left""
width=""100""> Phone:</td><td align=""left""> <input class=""TextBox""
type=""text"" id=""phone"" name=""phone"" size=""29"" value=""" &
Request("phone") & """ readonly tabindex=""10""></td></tr>" & _
"<tr><td align=""left"" width=""100""> Fax:</td><td align=""left""> <input
class=""TextBox"" type=""text"" id=""fax"" name=""fax"" size=""29"" value="""
& Request("fax") & """ readonly tabindex=""11""></td><td align=""left""
width=""100""> Email:</td><td align=""left""> <input class=""TextBox""
type=""text"" id=""email"" name=""email"" size=""29"" value=""" &
Request("email") & """ readonly tabindex=""12""></td></tr>" & _
"<tr><td colspan=""4"" align=""right"" valign=""top"">" & _
"<table
Style=""font-family:Arial;font-size:10pt;font-weight:bold;color:#000000;""
width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0""><tbody>" & _
"<tr><td align=""left"" width=""100"" valign=""top""> Comments: </td><td
align=""left""><textarea class=""TextBox"" id=""comments"" name=""comments""
cols=""83"" rows=""5"" readonly tabindex=""13"">" & Request("comments") &
"</textarea> </td></tr>" & _
"</tbody></table></td></tr></tbody></table>" & _
"<p>***********************************************************************************" & _
"<P><br>Message Sent On: " & Now() & "</body></HTML>"

msgMail.Send
Set msgMail=nothing


ALSO TRIED:
"<table background=""table_background.jpg"" width=""703"" height=""490""
border=""0"" cellpadding=""0"" cellspacing=""0"">" & _


Is there something I am missing or Is there an easier way to do this?

Thanks Much In Advance,
R
 
D

Daniel Crichton

Rob wrote on Tue, 10 Jul 2007 10:16:02 -0700:
Hi,

I have a form (it works fine) but what I want to do is email the form
exactly as it is with the populated information. In otherwords, I want the
email sent to look just like the form that was filled out. I was able to
get it close but the problem I am having is that the form has a table in
it and the table uses a background JPG; but for some reason image is not
being included in the email and I'm stumped as to how to get it in there
where it belongs.

Here's the code I am using in the email function/sub.....

CODE:

& _ "<table
style="background-image:url('table_background.jpg');background-repeat:no-r
epeat;font-family:Arial;font-size:10pt;font-weight:bold;color:#000000;"
ALSO TRIED:
"<table background=""table_background.jpg"" width=""703"" height=""490""
border=""0"" cellpadding=""0"" cellspacing=""0"">" & _

Is there something I am missing or Is there an easier way to do this?

Change the above to have the full URL to the table_background.jpg image to
load from your site, eg. http://www.yoursite.com/table_background.jpg.

If you want to actually embed the image then this might help:

http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-in-html-format.html

Scroll down to the bit title "Embedding images in the e-mail". However this
will likely only work with Microsoft Outlook/Outlook Express. There are
likely ways to manage it to work with all HTML capable browsers, but I've
not used CDO myself. Personally I use Persits ASPEmail
(http://www.aspemail.com), it's fairly easy to create HTML with inline
images using this.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top