Sending HTML email with CDO and adding variable in body.

I'm trying to send a HTML email with variables. This is what I have, and getting the following error:

<%

//Request Data from PDF
var FirstName        = Request.form("FirstName")
var LastName         = Request.form("LastName")
var Email            = Request.form("Email")
var Ext              = Request.form("Ext")
var OfficeNumber     = Request.form("OfficeNumber")
var FlatPanel        = Request.form("FlatPanel")
var SmallMonitor     = Request.form("SmallMonitor")
var SevMonitor       = Request.form("SevMonitor")
var MonitorStand     = Request.form("MonitorStand")
var SmallPrinter     = Request.form("SmallPrinter")
var LargePrinter     = Request.form("LargePrinter")
var FlatbedScanner   = Request.form("FlatbedScanner")
var SelfUnits        = Request.form("SelfUnits")
var Bookcases        = Request.form("Bookcases")
var MiscEquipment    = Request.form("MiscEquipment")
var Comments         = Request.form("Comments")

// Email Information


var objMail = Server.CreateObject("CDO.Message");


      objMail.From = "safety@xxxxx.com";
      objMail.To = Email;
        objMail.Subject = "Earthquake Survey Confirmation";
      objMail.HTMLBody = "<P><body>Thanks <%= FirstName %>for your submission</body></p>";
      objMail.Send();
      objMail = null;
%>


//////Error I'm getting/////////


Technical Information (for support personnel)

Error Type:
Microsoft JScript compilation (0x800A03F7)
Unterminated string constant
/orderconfirm.asp, line 42, column 49


jkobzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pkaledaCommented:
Change the line to read this:

objMail.HTMLBody = "<P><body>Thanks "& FirstName &"for your submission</body></p>";
     
0
justinbilligCommented:
no if its javascript you have to do this

objMail.HTMLBody = "<P><body>Thanks " + FirstName + "for your submission</body></p>";
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkobzAuthor Commented:
Thanks pkaleda,

Looks as if the stmp mail server is stripping away my html mail, so I guess I have to go the .textbody route. Is it possible to format text mail somehow? Or any other suggestions?

Thanks
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

hongjunCommented:
try this?

objMail.HTMLBody = "<body><p>Thanks " + FirstName + "for your submission</p></body>";
0
hongjunCommented:
Also try this (before Send)

objMail.MimeFormatted = true
0
pkaledaCommented:
also add(before Send):

objMail.BodyFormat = 0
objMail.MailFormat = 0
0
jkobzAuthor Commented:
Thanks for the Feedback...

Everything worked like a charm, except when I added...

also add(before Send):

objMail.BodyFormat = 0
objMail.MailFormat = 0

It stated object wasn't supported...

Thanks
0
hongjunCommented:
BodyFormat and MailFormat are properties of CDONTS (not CDO)

>>Everything worked like a charm
Yeah :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.