 |
ขอถามอีกข้อนึงค่ะจะเขียน function ยังงัยให้ส่งเมล์ได้หลายๆเมล์น่ะค่ะ |
|
 |
|
|
 |
 |
|
<?
function connect()
{
mysql_connect("host","user","password");
mysql_select_db("dbname");
}
$header="From: webmaster@$SERVER_NAME\r\n"
."Reply-To: webmaster@$SERVER_NAME\r\n"
."X-Mailer: PHP/" . phpversion());
$masseage="ข้อความที่จะส่ง";
$topic="หัวข้อเรื่อง";
function sendmail($to)
{
global $header,$massage,$topic;
if(mail($row[mail],$topic,$message,$header))
echo "ส่งเมล์ถึง $row[mail] ได้ครับ";
else
echo "ไม่สามารถส่งเมล์ถึง $row[mail] ได้ครับ";
}
connect();
$rs=mysql_query("select mail from ชื่อเทเบิล");
while($row=mysql_fetch_array($rs,MYSQL_ASSOC))
{
sendmail($row[mail]);
}
?>
|
 |
 |
 |
 |
Date :
10 ก.ย. 2548 11:23:42 |
By :
test5 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?
function connect()
{
mysql_connect("host","user","password");
mysql_select_db("dbname");
}
$header="From: webmaster@$SERVER_NAME\r\n"
."Reply-To: webmaster@$SERVER_NAME\r\n"
."X-Mailer: PHP/" . phpversion());
$masseage="ข้อความที่จะส่ง";
$topic="หัวข้อเรื่อง";
function sendmail($to)
{
global $header,$massage,$topic;
if(mail($row[mail],$topic,$message,$header))
echo "ส่งเมล์ถึง $row[mail] ได้ครับ";
else
echo "ไม่สามารถส่งเมล์ถึง $row[mail] ได้ครับ";
}
if($select)
{
for($i=0;$i<count($user);$i++)
sendmail($user[$i]);
}
connect();
$rs=mysql_query("select mail from ชื่อเทเบิล");
?>
<FORM METHOD=POST ACTION="<?=$PHP_SELF?>">
<?
while($row=mysql_fetch_array($rs,MYSQL_ASSOC))
{
echo "<input type=checkbox name=\"user[]\" value=\"$row[mail]\">$row[mail]<br>";
}
?>
<input type=submit name=select value=yes>
</FORM>
|
 |
 |
 |
 |
Date :
10 ก.ย. 2548 11:37:26 |
By :
test6 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|