Re: \n problems when creating an email
| From: | Daniel Brown | Date: | Mon, 11 Feb 2008 15:48:05 +0000 |
| Subject: | Re: \n problems when creating an email | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269089@lists.php.net to get a copy of this message | ||
On Feb 11, 2008 7:10 AM, Angelo Zanetti <angelo@elemental.co.za> wrote:
> Hi guys,
>
> I am making email text based on some fields the user fills in and then email
> the admin the details.
>
> I am having a problem where sometimes the \n (new line) works and sometimes
> it just does nothing. Im not sure the cause but I cant seem to figure it
> out.
Try using HEREDOC syntax instead:
$message =<<<EOM
How far would they be prepared to travel to
event venue?
$travel
Do you have a specific location
of preference?
$locationPref
City or country preference: $cityPref
EOM;
It may not prevent the client from reformatting the message on
delivery, as Stut, Nathan, and Wolf already correctly mentioned, but
placing it in a HEREDOC will improve readability, send an exact
structure without need for interpretation (of
newlines-vs-carriage-return-newlines and number of spaces per tab),
and allow you to freely use quotes without having to remember to
escape them (or escape to insert a variable).
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>