Jump to content
Larry Ullman's Book Forums

How Can I Style The Text Sent Via Php Mail Form?


Recommended Posts

All my php generated emails look like they're 6 pixels high and, man, are they ugly.

Can anyone tell me how to add some size, fonts, color etc?

 

Here's a sample of my code:

	$body = "Name: {$_POST['name']}\n\nEmail: {$_POST['email']}\n\n Telephone: {$_POST['phone']}\n\n Comments: {$_POST['comments']}\n\n Checked Boxes:\n\n  {$checks}";
		
		// Make it no longer than 70 characters long:
		$body = wordwrap($body, 70);
		$from="Collaboration Age, Website Mail";
		mail('chop@myfairpoint.net', 'Contact Form Submission', $body, "From: {$from}");
		// A message is printed on the first panel of this website
		// that the email has been sent
		// Clear $_POST (so that the form's not sticky):
		$_POST = array();

thank you

Link to comment
Share on other sites

You actually need to generate and send HTML email to format it better. What mail() sends by default is plain text. You'll need to search online for sending HTML email using PHP. It's nearly impossible on its own, so you'll want to find a good third-party library to tap into.

Link to comment
Share on other sites

 Share

×
×
  • Create New...