[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Format string with carriage return for mail message

Posted on 2001-08-13
10
Medium Priority
?
269 Views
Last Modified: 2008-01-09
Hi Guys,
I am creating a HTML form with various input fields and when the user submits details they are entered in an SQL Server table.
But also I am e-mailing these details to certain people.
I am using CDONTS - (Set objCDO = Server.CreateObject("CDONTS.NewMail")
The body of the mail message will consist of all the details from the HTML form.
It is easy to read in all details from HTML form fileds and assign them to a string variable and then assign this string as the mail message body

objCDO.Body = string

But I want to put a carriage return after each form detail as I am reading it into string so as my message is nicely formatted when recipient gets it

Example
-------------------------------------
From: Willy Balda
Department: Extronics
Details: Testing Results - Completed
-------------------------------------
Any ideas appreciated

Cheers


B Cunney



0
Comment
Question by:Barry Cunney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 1

Expert Comment

by:russoffl
ID: 6381287
str & "<br>" should do it.

or

Response.Write("From: " & Request.Form("whatever") & "<br")
0
 
LVL 1

Expert Comment

by:russoffl
ID: 6381292
opps - last one shouldhve been

Response.Write("From: " & Request.Form("whatever") & "<br>")
0
 
LVL 2

Expert Comment

by:turbosig
ID: 6381297
can't you just insert a "<BR>"??
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Expert Comment

by:russoffl
ID: 6381303
If you are compliling a long string for the body of the email:

strBody = "From: " & Request.Form("whatever") & "<br>"
strBody = strBody & "Department: " & Request.FOrm("whatever_2") & "<br>"
strBody = strBody & "Detail: " ....etc, etc.
0
 
LVL 2

Accepted Solution

by:
MCM earned 320 total points
ID: 6381395
if the email you are sending is not in HTML format, then you want an actual carriage return and line character, ie:


strBody = "From: " & Request.Form("whatever") & Chr(13) & Chr(10)
strBody = strBody & "Department: " & Request.FOrm ("whatever_2") & Chr(13) & Chr(10)
strBody = strBody & "Detail: " ....etc, etc.

or equivalently:

strBody = "From: " & Request.Form("whatever") & vbCrLf
strBody = strBody & "Department: " & Request.FOrm ("whatever_2") & vbCrLf
strBody = strBody & "Detail: " ....etc, etc.


 
0
 
LVL 17

Author Comment

by:Barry Cunney
ID: 6381398
Hi Guys,
Below is very simple content of test mail.ASP I am trying:
Using <BR> but it does not seem to have any affect.
Just to keep things simple I am not requesting data from FORM, just assigning 2 strings to 2 variables and then trying to create body message with THESE 2 VARIABLES fname and lname on two different lines.
Should I be specifying a 'BodyFormat' for the mail message

objCDO.BodyFormat = ??


<HTML>
<HEAD>
<TITLE>Mail Test</TITLE>
</HEAD>
<BODY>

<%
Dim fname, lname
Dim objCDO

fname = "Willy"
lname = "Wonka"

Set objCDO = Server.CreateObject("CDONTS.NewMail")

objCDO.From = "test@test.com" 'That's me :)

objCDO.To = "bcunney@worldlinkits.com"
         
objCDO.Subject = "Submitted form data from my page"

objCDO.Body = "Name: " & fname & "<BR>" & lname

objCDO.Send

%>
0
 
LVL 2

Expert Comment

by:MCM
ID: 6381416
BodyFormat=1 will do HTML, BodyFormat=0 is plain text, with HTML you use "<BR>", with plain text, vbCrLF.
0
 
LVL 2

Expert Comment

by:MCM
ID: 6381423
oops, i got them backwards
0 is HTML, 1 is plain text only.
0
 
LVL 7

Expert Comment

by:John844
ID: 6381470
you can add a vbCrLf where you want the line break.
0
 
LVL 17

Author Comment

by:Barry Cunney
ID: 6381473
Thanks MCM
I used the vbCrLf option and set BodyFormat to plain text
and this has done the job.
I had tried Chr(13) before but this didn't seem to work.
Was not able to get <BR> and HTML bodyformat to work either.
But anyway Plaintext Bodyformat and vbCrLF has given desired result so I a fairly happy.

MANY Thanks


B Cunney
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

656 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