|
|
|
ส่งอีเมล์ถึงลูกค้าเวลาเพิ่มข่าวสารหน้าเว็บ โดยส่งลิงค์สั้น ๆ ให้มาอ่านบทความอีกทีครับ แบบ facebook |
|
|
|
|
|
|
|
ตัวอย่างนี้เลยครับ
Code (PHP)
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("customer");
$strSQL = "SELECT * FROM customer WHERE status = 'N' LIMIT 0,20 ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
$strTo = $objResult["Email"];
$strSubject = "Test Send Email";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: apinya \nReply-To: [email protected]";
$strVar = "My Message";
$strMessage = "
<h1>My Message</h1><br>
<table width='285' border='1'>
<tr>
<td><div align='center'><strong>My Message </strong></div></td>
<td><div align='center'><font color='red'>My Message</font></div></td>
<td><div align='center'><font size='2'>My Message</font></div></td>
</tr>
<tr>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
<td><div align='center'>My Message</div></td>
</tr>
<tr>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
<td><div align='center'>".$strVar."</div></td>
</tr>
</table>";
@mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
mysql_query("UPDATE customer SET status = 'Y' WHERE Email = '".$objResult["Email"]."' ");
}
?>
|
|
|
|
|
Date :
2012-03-23 06:10:44 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|