Jump to content

help sending html mail........


rahuul

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/194612-help-sending-html-mail/
Share on other sites

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.