Jump to content

Sending Email Problem


Hooch

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')"); 	?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...