|
|
|
ถามเรื่องการใช้ฟังก์ชั่น group_concat ครับ ให้ดึงอีเมล์มาแล้วส่งเมล์ไปหลายๆคน |
|
|
|
|
|
|
|
ทำไมไม่ loop ส่งเลยครับ ไม่ต้อง group_concat ก็ได้ครับ
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("customer");
$strSQL = "SELECT * FROM customer ";
$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 //
}
?>
|
|
|
|
|
Date :
2013-04-25 14:31:38 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|