從早上我一直在嘗試,但最後我必須把這個在stackoverflow。我一直在試圖通過PHP發送HTML郵件時,當我看到我的郵件我得到的HTML COADS恰好不是設計精美的郵件如何發送一個HTML設計的郵件通過郵件功能PHP
<?php
$email = $_POST["email"];
$to = $email;
$from = "[email protected]";
$subject = "Your thebigmall coupon code";
$headers = "From:" . $from;
ob_start();
?>
<html>
<head>
<title></title>
</head>
<body>
<p>
</p>
<div style="font-size: small; width: 797.4166870117188px; background-color: rgb(236, 236, 236); margin: 0px; padding: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; ">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr style="border-collapse: collapse; ">
<td align="center" bgcolor="#ececec" style="border-collapse: collapse; ">
<table border="0" cellpadding="0" cellspacing="0" style="margin: 0px 10px; " width="640">
<tbody>
<tr style="border-collapse: collapse; ">
<td height="20" style="border-collapse: collapse; " width="640">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="640">
<table bgcolor="#00707b" border="0" cellpadding="0" cellspacing="0" style="border-top-left-radius: 6px; border-top-right-radius: 6px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; background-color: rgb(4, 57, 72); color: rgb(231, 203, 163); " width="640">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="15">
</td>
<td align="left" style="border-collapse: collapse; " valign="middle" width="350">
<table border="0" cellpadding="0" cellspacing="0" width="350">
<tbody>
<tr style="border-collapse: collapse; ">
<td height="8" style="border-collapse: collapse; " width="350">
</td>
</tr>
</tbody>
</table>
<div style="font-size: 12px; ">
<a href="http://www.thebigmall.co.in" style="font-weight: bold; color: rgb(231, 203, 163); text-decoration: none; " target="_blank">Web Version</a></div>
<table border="0" cellpadding="0" cellspacing="0" width="350">
<tbody>
<tr style="border-collapse: collapse; ">
<td height="8" style="border-collapse: collapse; " width="350">
</td>
</tr>
</tbody>
</table>
</td>
<td style="border-collapse: collapse; " width="30">
</td>
<td align="right" style="border-collapse: collapse; " valign="middle" width="255">
<table border="0" cellpadding="0" cellspacing="0" width="255">
<tbody>
<tr style="border-collapse: collapse; ">
<td height="8" style="border-collapse: collapse; " width="255">
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " valign="middle">
<a href="http://preview.createsend3.com/t/j-fb-wukdik-l-t/" rel="cs_facebox" style="font-weight: bold; color: rgb(231, 203, 163); text-decoration: none; " target="_blank"><img alt="Facebook icon" border="0" height="14" src="https://img.createsend1.com/img/templatebuilder/like-glyph.png" style="min-height: auto; line-height: 13px; outline-style: none; display: block; " width="8" /></a></td>
<td style="border-collapse: collapse; " width="3">
</td>
<td style="border-collapse: collapse; " valign="middle">
<div style="font-size: 12px; ">
<a href="http://preview.createsend3.com/t/j-fb-wukdik-l-i/" rel="cs_facebox" style="font-weight: bold; color: rgb(231, 203, 163); text-decoration: none; " target="_blank">Like</a></div>
</td>
<td style="border-collapse: collapse; " width="10">
</td>
<td style="border-collapse: collapse; " valign="middle">
<a href="http://client.forwardtomyfriend.com/j-l-2AD73FFF-wukdik-l-d" lang="en" style="font-weight: bold; color: rgb(231, 203, 163); text-decoration: none; " target="_blank"><img alt="Forward icon" border="0" height="14" src="https://img.createsend1.com/img/templatebuilder/forward-glyph.png" style="min-height: auto; line-height: 13px; outline-style: none; display: block; " width="19" /></a></td>
<td style="border-collapse: collapse; " width="3">
</td>
<td style="border-collapse: collapse; " valign="middle">
<div style="font-size: 12px; ">
<a href="http://client.forwardtomyfriend.com/j-l-2AD73FFF-wukdik-l-h" lang="en" style="font-weight: bold; color: rgb(231, 203, 163); text-decoration: none; " target="_blank">Forward</a></div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="255">
<tbody>
<tr style="border-collapse: collapse; ">
<td height="8" style="border-collapse: collapse; " width="255">
</td>
</tr>
</tbody>
</table>
</td>
<td style="border-collapse: collapse; " width="15">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td align="center" bgcolor="#00707b" style="border-collapse: collapse; " width="640">
<table border="0" cellpadding="0" cellspacing="0" width="640">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td height="30" style="border-collapse: collapse; " width="580">
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td style="border-collapse: collapse; " width="580">
<div align="center">
<p style="color: rgb(231, 203, 163); font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; font-size: 36px; margin-top: 0px; margin-bottom: 30px; ">
<strong>TheBigMall Coupon code !</strong></p>
</div>
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td bgcolor="#ffffff" height="30" style="border-collapse: collapse; " width="640">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td bgcolor="#ffffff" style="border-collapse: collapse; " width="640">
<table border="0" cellpadding="0" cellspacing="0" width="640">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td style="border-collapse: collapse; " width="580">
<table border="0" cellpadding="0" cellspacing="0" width="580">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="580">
<h1 align="left" style="font-size: 18px; line-height: 24px; color: rgb(154, 150, 97); font-weight: bold; margin-top: 0px; margin-bottom: 18px; ">
25% off on modular kitchens (Faizabad Road)</h1>
<div align="left" style="font-size: 13px; line-height: 18px; color: rgb(68, 68, 68); margin-top: 0px; margin-bottom: 18px; ">
<p style="margin-bottom: 15px; ">
<strong>Offer Details</strong></p>
<p style="margin-bottom: 15px; ">
Make your kitchen a beautiful place to cook with RECENT KITCHEN WORLD</p>
<p style="margin-bottom: 15px; ">
Get 25% discount on total billing amount on modular kitchens manufacturing. </p>
<p style="margin-bottom: 15px; ">
Our Products:<br style="line-height: 13px; " />
Marine Ply Shutter (Weather Proof)<br style="line-height: 13px; " />
Marine Ply Carcass (Weather Proof)<br style="line-height: 13px; " />
Acrylic shutter<br style="line-height: 13px; " />
Civil work<br style="line-height: 13px; " />
Chimney<br style="line-height: 13px; " />
150 Colours available</p>
<p style="margin-bottom: 15px; ">
Offer for limited period. So don't leave this opportunity & make your kitchen beautiful !!!</p>
</div>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td height="10" style="border-collapse: collapse; " width="580">
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="580">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="580">
<p align="left" style="font-size: 18px; line-height: 24px; color: rgb(154, 150, 97); font-weight: bold; margin-top: 0px; margin-bottom: 18px; ">
Coupon code !</p>
<div align="left" style="font-size: 13px; line-height: 18px; color: rgb(68, 68, 68); margin-top: 0px; margin-bottom: 18px; ">
<h1 style="margin-bottom: 15px; text-align: center; ">
12345$randstr$randstr2</h1>
<p style="margin-bottom: 15px; ">
</p>
</div>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td height="10" style="border-collapse: collapse; " width="580">
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="580">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="580">
<p align="left" style="font-size: 18px; line-height: 24px; color: rgb(154, 150, 97); font-weight: bold; margin-top: 0px; margin-bottom: 18px; ">
Address :</p>
<div align="left" style="font-size: 13px; line-height: 18px; color: rgb(68, 68, 68); margin-top: 0px; margin-bottom: 18px; ">
<p style="text-align: center; margin-bottom: 15px; ">
Store Address :Kamta Check Post, Faizabad Road, Opp. Kamta Petrol Pump, Lucknow.<br style="line-height: 13px; " />
City :Lucknow<br style="line-height: 13px; " />
Contact No.9415255816, 9721961276, 9918404211<br style="line-height: 13px; " />
<span style="color: rgb(255, 0, 0); ">Offers valid for 48 hours only.</span></p>
</div>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td height="10" style="border-collapse: collapse; " width="580">
</td>
</tr>
</tbody>
</table>
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td bgcolor="#ffffff" height="15" style="border-collapse: collapse; " width="640">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="640">
<table bgcolor="#043948" border="0" cellpadding="0" cellspacing="0" style="border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; background-color: rgb(4, 57, 72); color: rgb(226, 226, 226); " width="640">
<tbody>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td height="30" style="border-collapse: collapse; " width="360">
</td>
<td style="border-collapse: collapse; " width="60">
</td>
<td style="border-collapse: collapse; " width="160">
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td style="border-collapse: collapse; " valign="top" width="360">
<p align="left" style="font-size: 12px; line-height: 15px; margin-top: 0px; margin-bottom: 15px; ">
</p>
<p align="left" style="font-size: 12px; line-height: 15px; margin-top: 0px; margin-bottom: 15px; ">
All Rights Reserved > TheBigMall.co.in - Great discounts in your city</p>
</td>
<td style="border-collapse: collapse; " width="60">
</td>
<td style="border-collapse: collapse; " valign="top" width="160">
<p align="right" style="font-size: 11px; line-height: 16px; margin-top: 0px; margin-bottom: 15px; color: rgb(231, 203, 163); ">
</p>
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td style="border-collapse: collapse; " width="30">
</td>
<td height="15" style="border-collapse: collapse; " width="360">
</td>
<td style="border-collapse: collapse; " width="60">
</td>
<td style="border-collapse: collapse; " width="160">
</td>
<td style="border-collapse: collapse; " width="30">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="border-collapse: collapse; ">
<td height="60" style="border-collapse: collapse; " width="640">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<img border="0" height="1" src="https://createsend3.com/t/j-o-wukdik-l/o.gif" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important; line-height: 13px; outline-style: none; display: block; " width="1" /></div>
<div>
</div>
<p>
</p>
</body>
</html>
<?
$message = ob_get_clean();
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
你米發出郵件標題來說出它的html電子郵件 – 2012-10-01 19:37:39
**「width:797.4166870117188px」**我會想到的極端極端,將像素分成兩半是不夠的,但是這樣? :-) – 2012-10-01 19:41:05
請糾正它的代碼我是一個新手,這將是非常有幫助的我 –