Jump to content

Sending Email Problem


Hooch
 Share

Recommended Posts

Hello all. I am having problems with an email form. I have the info sent to a DB and also an admin on the site. The DB info works and prints out perfect. But the email shows "\r\n" where a new line is created in the form. This would be $message in the code below.

<?PHP	//From the Form	$message = mysql_real_escape_string($_POST['txtMessage']);		//Get info looking good to send	$fullmessage =	"Message recieved: $today at $time:\n" .	"Email Sent From: TIArts.org\n" .	"Name: $name\n".	"Email: $email\n".	"Phone Number: $phone Ext: $ext\n".	"Mailing list?: $letter2\n\n".			"------------------------ COMMENTS ------------------------\n\n" .		nl2br($message) .	"\n\n-----------------------------------------------------------------\n";		//Send email	mail("me@mysite.com", $subject, $fullmessage, "From: $name <$email>");		//Enter info to the DB	$db_query = mysql_query("INSERT INTO `table` ( `id`, `message`) VALUES ('', '$message')"); 	?>

nl2br($message) . is the problem. I have tried many variations here...but nothing works. Any help would be terrific. Thank you***EDIT***I just fixed it.If anyone is interested here's the fix

<?PHP	//From the Form	$message = $_POST['txtMessage'];		//Get info looking good to send	$fullmessage =	"Message recieved: $nowDay at $nowClock:\n" .	"Email Sent From: TIArts.org\n" .	"Name: $name\n".	"Email: $email\n".	"Phone Number: $phone Ext: $ext\n".	"Mailing list?: $letter2\n\n".			"------------------------ COMMENTS ------------------------\n\n" .		stripslashes($message) .	"\n\n-----------------------------------------------------------------\n";		//Send email	mail("me@mysite.com", $subject, $fullmessage, "From: $name <$email>");		//Clean the message post before entering to the DB	$message = mysql_real_escape_string($_POST['txtMessage']);		//Enter info to the DB	$db_query = mysql_query("INSERT INTO `table` ( `id`, `date`, `name`, `email`, `subject`, `phone`, `ext`, `email_list`, `message`) VALUES ('', '$date', '$name', '$email', '$subject', '$phone', '$ext', '$letter2', '$message')"); 	?>

Edited by Hooch
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...