Home > Archive > PHP Programming > November 2006 > How to have line breaks in this text
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to have line breaks in this text
|
|
|
| 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
| |
| Krustov 2006-11-29, 9:57 pm |
| <comp.lang.php>
<Rock>
<Thu, 30 Nov 2006 11:42:41 +1100>
<456e2bfe$0$9770$afc38c87@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="webmaster@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
| |
| BKDotCom 2006-11-29, 9:57 pm |
|
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
| |
| John Dunlop 2006-11-30, 3:59 am |
| 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
| |
| Jeff North 2006-11-30, 3:59 am |
| On Thu, 30 Nov 2006 11:42:41 +1100, in comp.lang.php Rock
<1940@pobox.com>
<456e2bfe$0$9770$afc38c87@news.optusnet.com.au> 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.
>|
>|
>| 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 />.
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
|
|
|
|
|