[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending HTML email with CDO and adding variable in body.

Posted on 2004-11-30
8
Medium Priority
?
728 Views
Last Modified: 2007-12-19
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


0
Comment
Question by:jkobz
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 6

Expert Comment

by:pkaleda
ID: 12708316
Change the line to read this:

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

Accepted Solution

by:
justinbillig earned 1600 total points
ID: 12708338
no if its javascript you have to do this

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

Author Comment

by:jkobz
ID: 12708500
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 400 total points
ID: 12708559
try this?

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

Expert Comment

by:hongjun
ID: 12708603
Also try this (before Send)

objMail.MimeFormatted = true
0
 
LVL 6

Expert Comment

by:pkaleda
ID: 12708787
also add(before Send):

objMail.BodyFormat = 0
objMail.MailFormat = 0
0
 

Author Comment

by:jkobz
ID: 12709331
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
 
LVL 33

Expert Comment

by:hongjun
ID: 12711695
BodyFormat and MailFormat are properties of CDONTS (not CDO)

>>Everything worked like a charm
Yeah :)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question