Basic question - how do I send an email with css formatting? I've been trying to mail something along the lines of the example below; $message = "<table width='450' style='background: green'>"; $message = "<tr><td style='color: #E0E0E0'>I'm green and slimey</td></tr>"; $message = "</table>"; mail($email, $subject, $message, $mailheaders); It doesnt seem to do anything within the quotes e.g. width='450' or style='....' Do I need to set up the type of email in the $message variable?
The following works for me: $subject = "title"; $message = " <html> <head> <LINK REL=\"StyleSheet\" HREF=\"http://www.domain.org.uk/style.css\" TYPE=\"text/css\"> </head> <body> <table><tr><td class=\"content\" colspan=3> content </td></tr> </table> </body> </html> "; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: no-reply@domain.org.uk <no-reply@domain.org.uk>\r\n"; mail("$to", $subject, $message, $headers); PHP: Alternatively you could try adding a \ before your ' eg width=\'400\' Also you should use an inline style sheet rather than an external one like I do.