Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gettin a newline into a variable

Status
Not open for further replies.

CliveC

Programmer
Nov 21, 2001
1,222
US
I am using the MAIL function and would like to get carriage return into my message. I thought this would work but it doesn't. Any ideas?

<html>
<head><title>Mail To</title></head>
<body>
THIS IS A TEST
<script language=&quot;php&quot;>
$etype=$HTTP_GET_VARS['etype'];
$email=$HTTP_GET_VARS['email'];
$Name=$HTTP_GET_VARS['Name'];
$HomePhone=$HTTP_GET_VARS['HomePhone'];
$WorkPhone=$HTTP_GET_VARS['WorkPhone'];
$CallTime=$HTTP_GET_VARS['CallTime'];
$emsg=&quot;\r&quot;.
&quot;Name: &quot;.$Name.&quot;\r&quot;.
&quot;Home Phone: &quot;.$HomePhone.&quot;\r&quot;.
&quot;Work Phone: &quot;.$WorkPhone.&quot;\r&quot;.
&quot;Best time to call: &quot;.$CallTime.&quot;\r&quot;.
print $emsg;
mail(&quot;$email&quot;,&quot;TEST - $etype&quot;,&quot;$emsg&quot;)
</script>
</body></html>
 
p.s. There is a semi-colon after the last \r in the real version.
 
try \n ***************************************
Party on, dudes!
[cannon]
 
Hi Karver,
Thanks for the response. I did try \n and that did not work either.
 
<BR> works for the &quot;print $emsg&quot; version but not for the email.
 
Just to add to the list, inserting chr(13) doesn't work either..

Now you really got me thinking :) ***************************************
Party on, dudes!
[cannon]
 
html line breaks don't work either : & #10; ***************************************
Party on, dudes!
[cannon]
 
Have you defined the content of the email to be html?

Then add the <br>

hth Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Tried <br> too ... thats why I'm onto the weird stuff :)

So far:
\r
\n
\l\r
<br>
chr(13)
& #10;
\x0A

anyone else got any ideas?
Failing that, try using a mime-mail class ***************************************
Party on, dudes!
[cannon]
 
Bastien,
How do you do that? If you mean in my email profile that wont work because I don't know the recipient. That is, I am not sending mail to myself.

Karver,
Thanks for all your efforts. We will get it eventually!
 
hi

there is a php contructor function that can create a html email that I found, which of course I now can't find on my machine...can't even remember where I got it...do a search on PHP email scripts and you should find something like it...allows the body to be html...

hth Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Thanks Bastien,
I still haven't figured this out.
 
fyl_nc
Yes it works. brilliant! Thanks.
 
Doh .. about the only combo I never tried :)

Well played, fyl_nc! ***************************************
Party on, dudes!
[cannon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top