Formatting an output for email is quite tricky as some (especially webmail) programs will strip out all or some HTML tags including your doc type ref if included.
I use a custom built function called buildEmail() that accepts a number of parameters such as an array of fields to use in email, the max email width - typically 70 characters and anything else to be included.
When I have created emails in the past I always found difficulty using \n\r to break but soon realised that creating a string using:
$str = 'text\n\rtext'
will ignore the formatting so you will need to use "" for your string.
You can build up an HTML email and include tables such as:
$str = "<html>";
$str .= "<body>";
$str .= $some_content."</td></tr></table></body></html>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <firstname.lastname@example.org>, Kelly <email@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <firstname.lastname@example.org>' . "\r\n";
$headers .= 'Cc: email@example.com' . "\r\n";
$headers .= 'Bcc: firstname.lastname@example.org' . "\r\n";
// Mail it
$to = 'email@example.com';
$subject = 'Some subject';
mail($to, $subject, $str, $headers);
For more information check out mail()