rahuul Posted March 9, 2010 Share Posted March 9, 2010 hi all, i hv a small code from sending mail to users $mail_body ='<style> tr{font-family:verdana; font-size:12px; color:#666666; padding:0px; margin:0px; } </style> <table width="100%" cellpadding="6" cellspacing="0"> <tr> <td>Dear Admin, </td> </tr> <tr> <td >A new Quote Request has been recived. Please check in admin panel. </td> </tr> <tr> <td></td> </tr> <tr> <td>Best Regards, </td> </tr> <tr> <td>ADMIN</td> </tr> </table>'; $mail_subject ='New Inquiry Request Received'; $sender =$email; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "To: ".ADMIN_EMAIL."\r\n"; $headers .= "from: $sender\r\n"; @mail('', $mail_subject , $mail_body, $headers); when i m reciving email is is some thing like this tr{font-family:verdana; font-size:12px; color:#666666; padding:0px; margin:0px; } Dear Admin, A new Quote Request has been recived. Please check in admin panel. Best Regards,ADMIN pls help what is wrong in my code...... it is not giving right formatting Quote Link to comment https://forums.phpfreaks.com/topic/194612-help-sending-html-mail/ Share on other sites More sharing options...
schilly Posted March 9, 2010 Share Posted March 9, 2010 if you want to send an html email through the mail() fn you need to format the body differently as you need the proper tags to represent an html email. Quick google search: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Either that way or use PHP Mailer. Quote Link to comment https://forums.phpfreaks.com/topic/194612-help-sending-html-mail/#findComment-1023707 Share on other sites More sharing options...
Adam Posted March 9, 2010 Share Posted March 9, 2010 if you want to send an html email through the mail() fn you need to format the body differently as you need the proper tags to represent an html email. Quick google search: http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php Either that way or use PHP Mailer. He's set the header to HTML. Try changing <style> to <style type="text/css">.. "type" is a required attribute so the client or your browser may not be rendering the style sheet correctly. Quote Link to comment https://forums.phpfreaks.com/topic/194612-help-sending-html-mail/#findComment-1023711 Share on other sites More sharing options...
schilly Posted March 9, 2010 Share Posted March 9, 2010 ooops my bad. Quote Link to comment https://forums.phpfreaks.com/topic/194612-help-sending-html-mail/#findComment-1023722 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.