?
Solved

Formatting a text email using CDO and Javascript

Posted on 2004-11-29
5
Medium Priority
?
1,230 Views
Last Modified: 2012-08-13
Hello,

I'm tring to format a multi-line text email being sent from my asp page using javascript. How would I do this? I tried using '& vbclr', but it's not working.

This is my code..

var objMail = Server.CreateObject("CDO.Message");
      objMail.From = "safety@xxxxx.com";
      objMail.To = Email;
        objMail.Subject = "Earthquake Survey Confirmation";
      objMail.TextBody = "Hello  " + FirstName + ",";   /////***** need to start a second line here***********////
      objMail.Send();
      objMail = null;
%>
0
Comment
Question by:jkobz
  • 3
5 Comments
 
LVL 9

Expert Comment

by:jmelika
ID: 12701802
&VbClr is a VB thing (ASP).  For Javascript, use /n

JM
0
 
LVL 9

Expert Comment

by:jmelika
ID: 12701823
I'm not sure if it's Javascript though.  Your code looks very much ASP to me.  Try this:

var objMail = Server.CreateObject("CDO.Message");
     objMail.From = "safety@xxxxx.com";
     objMail.To = Email;
        objMail.Subject = "Earthquake Survey Confirmation";
     objMail.TextBody = "Hello  " + FirstName + ","
     objMail.TextBody = objMail.TextBody & VbCrLf & "Your new lines"
     objMail.Send();
     objMail = null;
0
 
LVL 9

Assisted Solution

by:jmelika
jmelika earned 1000 total points
ID: 12701827
And by the way, I made a typo in my first post.  Javascript line feed is \n and not /n

JM
0
 

Author Comment

by:jkobz
ID: 12702605
Hi JM...

I tried that...here is my exact code...and this is what i get

code..

<%@ LANGUAGE = JavaScript%>

<%

//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@adobe.com";
      objMail.To = Email;
        objMail.Subject = "Earthquake Survey Confirmation";
      objMail.TextBody = "Hello  " + FirstName + ","
           objMail.TextBody = objMail.TextBody & VbCrLf & "Your new lines"

      objMail.Send();
      objMail = null;
%>



error i get in browser

Error Type:
Microsoft JScript runtime (0x800A1391)
'VbCrLf' is undefined
/orderconfirm.asp, line 33


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; FunWebProducts; SV1)

Page:
POST 83 bytes to /orderconfirm.asp

POST Data:
Email=jkobz%40adobe.com&Ext=987&FirstName=ss&LastName=ss&OfficeNumber=98797&Submit=

Time:
Monday, November 29, 2004, 7:41:22 PM


More information:
0
 
LVL 2

Accepted Solution

by:
Digga earned 1000 total points
ID: 12704026
Try changing this:
objMail.TextBody = objMail.TextBody & VbCrLf & "Your new lines"

to this:
objMail.TextBody = objMail.TextBody + VbCrLf + "Your new lines"
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month16 days, 10 hours left to enroll

864 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