How send html with mail in PHP

Just copy this code and paste it in your page.
$subject=”testing purpose only”;
$recipient=”your mail here”;
$email_from =”From mail here”;
$headers =”From: $email_from \r\nMIME-Version: 1.0\r\nContent-type:text/html;charset=iso-8859-1″;
// Registration Mail
$msg=”<table width=’607′ border=’0′ align=’center’ cellpadding=’0′ cellspacing=’0′ style=’width:607px; border:1px solid #aaaaaa; padding:5px; height:auto;’>

<td><table width=’596′ border=’0′ align=’center’ cellpadding=’0′ cellspacing=’0′>
<td style=’padding:12px; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#303030; line-height:20px;’><strong>Dear user,</strong><br />
Just enjoy your mail<br/>
Kind Regards, <br />
<strong>Raghunath Gurjar</strong> <br />
<a href=’; target=’_blank’ title=’Raghunath’></a><br />
<p>You can also contect me for any more query on <a href=””></a></p>

// Send mail




Note:Some time Google mail is not supported this format. so please in that case you can use below given stepes for change content type in your header :

  1. $headers =”From: $email_from \r\nMIME-Version: 1.0\r\nContent-type:text/html;charset=utf-8″;  
  2.  OR
  3. $headers =”From: $email_from \nMIME-Version: 1.0\nContent-type:text/html;charset=utf-8″;




Sr. Software Engineer

Posted in PHP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Recent Posts
%d bloggers like this: