Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> [solved] Trouble With New Lines In Mail.

This is a discussion on [solved] Trouble With New Lines In Mail., within the PHP section. This forum and the thread "[solved] Trouble With New Lines In Mail." are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> [solved] Trouble With New Lines In Mail.
Jason
post Jul 28 2008, 08:23 AM
Post #1


Master of the Universe
Group Icon

Posts: 1,298
Joined: 15-February 08
From: London, England


I am having trouble with new lines within e-mails. The new lines work up to the $message variable. I will talk you through my code. Could someone point out why the \n are being added to e-mails but they are being interpretted as plain text.

Message is stored as content variable as multiple functions require it. The validate function checks if the $_POST['content'] exists and returns "<em>'Message'</em>" if it isn't found. No string manipulation occurs within the validate function.
CODE
$this->content = $this->Validate(mysql_real_escape_string($_POST['content']), 'exists', "<em>'Message'</em>");


The send function is run. The relevant part of the send function is the following. The \n I specify up to the $message variable work fine. It is just the message itself which is the problem.
CODE
$message = $this->content;
$email_header = "From: $email_field\n"."Reply-To: $email_field\n"."MIME-Version: 1.0\n"."Content-type: text/plain;";
$email_header = stripslashes(strip_tags(trim($email_header)));
$body = "From: $name_field\n E-Mail: $email_field\n Phone:$phone_field\n Message:\n $message";


Any ideas why the \n within message is being interpreted as plain text?


EDIT: Moved mysql_real_escape_string to the db function


--------------------
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   19 alex 358 15th February 2008 - 01:12 PM
Last post by: karinne
No New Posts   9 caminowebmaster 241 15th February 2008 - 06:24 PM
Last post by: Jacob
No New Posts   3 c010depunkk 452 21st February 2008 - 09:41 AM
Last post by: c010depunkk
No New Posts   9 thesealportalteam 329 17th March 2008 - 12:24 PM
Last post by: thesealportalteam
No New Posts   6 Jason 263 27th March 2008 - 09:42 AM
Last post by: Jason