escaping quotes in mail() message
| From: | Lowell Allen | Date: | Mon, 03 Feb 2003 15:42:12 +0000 |
| Subject: | escaping quotes in mail() message | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134133@lists.php.net to get a copy of this message | ||
I'm having a problem escaping double quotes in email messages sent with
mail(). The message is built as a string and assigned to a variable and the
variable name is passed to the mail function.
The double quotes appear correctly in a simple test like this:
$message = "This message uses 'single' and \"double\" quotes.";
mail($sendto, $subject, $message, $headers);
But if $message is built in another part of the script and passed as a
hidden input of a form, the email arrives with the message truncated at the
first double quote encountered. If I do a str_replace() on $message to
escape double quotes, the email shows the escaping backslash but is still
truncated at the double quote!
I've got magic_quotes on, but I think I'm keeping up with stripslashes
because single quotes are showing up correctly.
Can anyone please advise?
--
Lowell Allen