getting a newline into an email?

G

Geoff Cox

Hello,

I am using prototype.js and part of what is sent to formmail.cgi to be
sent to me by email is a string containing 5 sets of numbers.

I would like to put some carriage return characters in so that these 5
sets are each displayed on a separate line in the email.

How do I do this? I have tried adding "\n", <br>, e and
.....!

Cheers

Geoff
 
D

Danny@Kendal

Geoff Cox said:
Hello,

I am using prototype.js and part of what is sent to formmail.cgi to be
sent to me by email is a string containing 5 sets of numbers.

I would like to put some carriage return characters in so that these 5
sets are each displayed on a separate line in the email.

How do I do this? I have tried adding "\n", <br>, e and
....!

You need to insert the real character, not an equivalent.
Try something like this:

cr = String.fromCharCode(13)
document.write(strLine1 + cr + strLine2)
 
G

Geoff Cox

cr = String.fromCharCode(13)
document.write(strLine1 + cr + strLine2)

Danny,

I have tried the code below - is that how you meant? It doesn't work
though! Can you see why? I wonder wether the prototype.js library
which I am using to send the data to the cgi script is removing any
characters?

Geoff

var cr = String.fromCharCode(13)
document.getElementById("Slider1ValueText").innerHTML = "";

for (situation_number = 0; situation_number <7;
situation_number++)
{
document.getElementById("Slider1ValueText").innerHTML += cr +
"Situation Number: " + situation_number + " ";

for (var i = 0; i <
slider_value_situation_number.length; i++)
{
document.getElementById("Slider1ValueText").innerHTML
+= this.slider_value_situation_number + ' ';
}
}

var recipient = "extraemails";
var realname = "SPA Form";
var situation_value = "Social Group";
var url = 'http://website/path/formmail-nms.cgi';
var pars = 'recipient=' + recipient + '&' + 'realname=' + realname
+ '&' + 'Situation=' + situation_value + '&' + 'Name=' + name + '&' +
'Slider Values=' +
document.getElementById('Slider1ValueText').innerHTML;
var myAjax = new Ajax.Updater('Status', url, {method: 'post',
parameters: pars});
}
 
A

ASM

Geoff said:
Hello,

I am using prototype.js and part of what is sent to formmail.cgi to be
sent to me by email is a string containing 5 sets of numbers.

I would like to put some carriage return characters in so that these 5
sets are each displayed on a separate line in the email.

How do I do this? I have tried adding "\n", <br>, e and

in your post here, return cariages seem to be : \r
 
P

PDannyD

On Tuesday 13 September 2005 14:39, Geoff
Cox([email protected]) wrote in message
Danny,

I have tried the code below - is that how you meant? It doesn't work
though! Can you see why? I wonder wether the prototype.js library
which I am using to send the data to the cgi script is removing any
characters?

[now posting from home]

That'd be my next thing to look at.

All the normal means of applying a newline/carriage-return don't seem to
work so either you're doing something wrong (nobody's perfect) or the code
somewhere is stripping out newline characters.

On a related note - I posted a comment to the BBC News website and split my
paragraphs apart with an empty line, like I have done with this post, and
it appeared as just one large paragraph on the website.
 
A

ASM

PDannyD said:
On Tuesday 13 September 2005 14:39, Geoff
Cox([email protected]) wrote in message
Danny,

I have tried the code below - is that how you meant? It doesn't work
though! Can you see why? I wonder wether the prototype.js library
which I am using to send the data to the cgi script is removing any
characters?


[now posting from home]

and that :

<html>
<a href="#" onclick="
var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
'if return carriages%0D%0Aare understood';
alert(asm);
location.href='mailto:[email protected]?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

which works fine for me at home
 
R

RobG

ASM wrote:
[...]
<html>
<a href="#" onclick="
var asm = 'hello,%0D%0A%0D%0Athere is a little message to%0D%0Asee '+
'if return carriages%0D%0Aare understood';
alert(asm);
location.href='mailto:[email protected]?'+
'subject=saluti a tuti&body='+asm;
return false;
">mail</a>
</html>

Using encodeURI with '\n' works for me:

<input type="button" value="Send mail..." onclick="

var asm = 'hello,\nhere is a little message to\nsee '+
'if return carriages\nare understood';
alert(asm);
location.href='mailto:[email protected]?'+
'subject=saluti a tuti&body='+encodeURI(asm);
return false;

">
 
G

Geoff Cox

On Tue, 13 Sep 2005 21:00:21 +0200, ASM

Stephane,

Someone has given me the answer!

I used escape()

ie escape("\n")

!!

Cheers

Geoff
 

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

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top