Got an issue with css in php.
Actually I'm trying to create and send a html email.
My front-end form consists of To(textbox where recipients email address will be entered) and then I've embedded ckeditor in place of Textarea where I will be typing the message... Now this ckeditor being a rich text editor has got all the features of aligning text towards left, or center, or right, coloring the text...etc..
Now when I hit submit button, this typed text within the editor gets converted into html code and gets collected in a variable $message in my back end php file.
so its like
and then I've created a table layout...
so its like..
$messages = " <html> <body> <p><strong>Recent Updates</strong></p> <p></p> <table border='0' style='border-collapse: collapse' width='700px'> <tr height='40px'> <td bgcolor='#444A48' border='none' width='55%'> <h3 style='text-align:right; font-family: Comic Sans MS; color: #fff; padding-top:5px;'>Updates</h3> </td> <td bgcolor='#444A48'> </td> </tr> <tr> <td bgcolor='#000' height='50px' border='none' colspan='2'> </td> </tr> <tr height='300px' style='border:1px solid #000;'> <td colspan='2' style='padding: 5px;' valign='top'> <p style='color:#000; font-size: 12px; font-family: Arial;'> ".$message." </p> </td> </tr> <tr border='1'> <td style='text-align: center;' bgcolor='#000' colspan='2' height='50px'> </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: firstname.lastname@example.org"; $sent=mail($to,$subject,$messages,$headers); }
Noticed that $message between this html layout..?
That contains the text typed in the Rich text editor... I mean that will contain the dynamically generated html content with css code..
Problem is that the inline css code generated by the editor is not getting applied...and in the inbox I receive mail with just plain content... I mean no color, and its default font-family... I know something is going on with single and double quotes, just don't know how to tackle it.. I've tried escape sequences, heredoc, htmlspecialchars_decode.... But all in vain..
Sorry for the lengthy post, and thanks all for your time and consideration.