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
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.

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.