|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Contact Form, Remove \r\n
Hi all,
I'm getting frustrated with these \r\n thingies. When I submit my contact form and the email gets sent to me it looks like this. Message: bu hu \r\nbu hu\r\nbu hu\r\nbu hu\r\n\r\nbu When it should look like: bu hu bu hu.. (Testing only). I've tried nl2br but that places in <br /> and doesn't make chars go into a new line when I check my mail. Any ideas? |
|
#2
|
|||
|
|||
|
If you are seeing the break tags, it is because you are sending the email as plain text. You need to send in html format if you want breaks to work.
http://us.php.net/manual/en/function.mail.php Example 4 should help |
|
#3
|
|||
|
|||
|
I've tried what you suggest but now I can't get nl2br() to put <br /> there instead of \r\n. It does nothing and leaves the same string as before.
But email is being sent as HTML tho. Just doesn't change \r\n to <br />. |
|
#4
|
|||
|
|||
|
Code:
$data = str_replace("\r\n", "<br />", $data);
Give that a whack |
|
#5
|
|||
|
|||
|
chances are if he is actually seeing the \r\n then he is using addslashes() on the string prior to adding it to a database and the back slashes are getting escaped. seems to me he should strip the slashes and then \r\n shouldn't show in the message.
|
|
#6
|
|||
|
|||
|
Sorry for the delay.
The problem with \r\n was that I used mysql_real_escape_string on $_POST['something']. Message is now being sent in html form just fine. Only problem is that subject and message parts aren't sent in UTF-8 afaik. Gmail doesn't display these characters "ž ć č š đ" eventhough charset is set to UTF-8. Here's the code I'm using. PHP Code:
Any ideas on what could be wrong? Thankyou in advance. Last edited by AnonG : October 22nd, 2009 at 02:28 PM. Reason: typos |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Contact Form, Remove \r\n |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|