By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

How to have line breaks in this text

P: n/a
Hello,

I am going bananas trying to get text breaks and empty lines into this text
which is sent in an email.

I have tried "'s and \n and r\n\ but the text in the email still wraps and also
I see the code in the text.

Can anyone help me please as I have Googled and searched but to no avail.
This is it....
define('UNOTIFY_MESSAGE','Hello, You have requested a Response. Choose a pdf
file and download it. Read it then come back to this site. Use the email
address and password you used to Login into your Account. Thank you for
supporting us and enjoy your day');

----------------------------------
I want it to be like this..
Hello,

You have requested a Response.

Choose a pdf file and download it. Read it then come back to this site.

Use the email address and password you used to Login into your Account.

Thank you for supporting us and enjoy your day
------------------------------------------
Thank you in anticipation

rock

Nov 30 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
<comp.lang.php>
<Rock>
<Thu, 30 Nov 2006 11:42:41 +1100>
<45**********************@news.optusnet.com.au>
This is it....
define('UNOTIFY_MESSAGE','Hello, You have requested a Response. Choose a pdf
file and download it. Read it then come back to this site. Use the email
address and password you used to Login into your Account. Thank you for
supporting us and enjoy your day');

----------------------------------
I want it to be like this..
Hello,

You have requested a Response.

Choose a pdf file and download it. Read it then come back to this site.

Use the email address and password you used to Login into your Account.

Thank you for supporting us and enjoy your day
Guesswork - your missing the <?php ?tags if you can see the code .

\n\n will do the line breaks for you .

<?php

$ewho="we*******@yourdomain.com";

$datesent=date("l dS of F Y h:i A");

$ip=$_SERVER['REMOTE_ADDR'];

$subject="FROM THE WEBSITE FORM";

$mailhead="From: $ewho \n";

$mailbody ="This email was sent via the website form" . "\n\n";
$mailbody .="DATE: " . "$datesent" . "\n\n";
$mailbody .="IP: " . "$ip" . "\n\n";
$mailbody .="Full Name: " . "$homer_01" . "\n\n";
$mailbody .="Email Address: " . "$homer_02" . "\n\n";
$mailbody .="Contact Number: " . "$homer_03" . "\n\n";

$body .=stripslashes($mailbody);

mail($ewho,$subject,$body,$mailhead);

?>
--
www.phpwhois.co.uk
Nov 30 '06 #2

P: n/a

Rock wrote:
Hello,

I am going bananas trying to get text breaks and empty lines into this text
which is sent in an email.

I have tried "'s and \n and r\n\ but the text in the email still wraps and also
I see the code in the text.

Can anyone help me please as I have Googled and searched but to no avail.
If you're "testing" it by echoing it out to your browser, \n's simply
won't do... you'd need to htmlify it with <BR />s

Nov 30 '06 #3

P: n/a
Rock:
I am going bananas trying to get text breaks and empty lines into this text
which is sent in an email.
Lines in an RFC2822 message are separated by
carriage-return/line-feed pairs. Bear in mind that lines are a
property of the data, not necessarily of the presentation of that data.
I have tried "'s and \n and r\n\ but the text in the email still wraps and also
I see the code in the text.
\r\n in a double-quoted string _is_ a CRLF pair. (I assume r\n\
was a typo.)

Short of using U+00A0 'NO-BREAK SPACE', the text would normally
wrap in smaller viewports.
define('UNOTIFY_MESSAGE','Hello, You have requested a Response. Choose a pdf
file and download it. Read it then come back to this site. Use the email
address and password you used to Login into your Account. Thank you for
supporting us and enjoy your day');
Since that string is single-quoted, \n and \r wouldn't be
interpreted. Either double quote the string or jump out of the
single-quotes and concatenate the CRLF pairs.

--
Jock

Nov 30 '06 #4

P: n/a
On Thu, 30 Nov 2006 11:42:41 +1100, in comp.lang.php Rock
<19**@pobox.com>
<45**********************@news.optusnet.com.auwrot e:
>| Hello,
|
| I am going bananas trying to get text breaks and empty lines into this text
| which is sent in an email.
|
| I have tried "'s and \n and r\n\ but the text in the email still wraps and also
| I see the code in the text.
|
| Can anyone help me please as I have Googled and searched but to no avail.
|
|
| This is it....
|
|
| define('UNOTIFY_MESSAGE','Hello, You have requested a Response. Choose a pdf
| file and download it. Read it then come back to this site. Use the email
| address and password you used to Login into your Account. Thank you for
| supporting us and enjoy your day');
|
| ----------------------------------
| I want it to be like this..
|
|
| Hello,
|
| You have requested a Response.
|
| Choose a pdf file and download it. Read it then come back to this site.
|
| Use the email address and password you used to Login into your Account.
|
| Thank you for supporting us and enjoy your day
| ------------------------------------------
In you're define statement you can use \n to force linefeeds.
When displaying this in a browser the \n will be ignored so you'll
need to use nl2br() to convert \n to <br />.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Nov 30 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.