gpt4 book ai didi

PHP 邮件 : Multiple recipients?

转载 作者:IT王子 更新时间:2023-10-29 01:15:57 25 4
gpt4 key购买 nike

我有这个代码:

<?php
include("db.php");

$result = mysql_query("SELECT * FROM email");

while($row = mysql_fetch_array($result))
{
$to = $row['address'];
}
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "example@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
?>

在我的表格(“电子邮件”)中,我有多个地址。(它们不是逗号分隔的。)我怎样才能将我的消息发送到所有这些地址?

最佳答案

while($row = mysql_fetch_array($result))
{
$addresses[] = $row['address'];
}
$to = implode(", ", $addresses);

mail() manual page 中所述,函数的“to”参数可以采用逗号分隔的地址列表。

关于PHP 邮件 : Multiple recipients?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7389035/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com