【发布时间】:2017-09-26 09:00:55
【问题描述】:
我正在尝试使用数据库来模拟电子邮件行为。这些是我用于向一位收件人发送邮件的代码。如何将其发送给多个收件人。
if($to=="" || $sub=="" || $msg=="")
{
$err= "<h3 style='color:red'>fill the related data first</h3>";
}
else
{
$d=mysqli_query($con,"SELECT * FROM userinfo where email='$to'");
$row=mysqli_num_rows($d);
if($row==1)
{
mysqli_query($con,"INSERT INTO usermail values('','$to','$id','$sub','$msg','$file',sysdate())");
$err= "<h3 style='color:blue'>Message sent...</h3>";
}
else
{
$sub=$sub."--"."msg failed";
mysqli_query($con,"INSERT INTO usermail values('','$id','$id','$sub','$msg','$file',sysdate())");
$err= "<h3 style='color:red'>Message failed because reciever not found...</h3>";
}
}
【问题讨论】:
-
此代码中的任何内容都不会发送电子邮件。
-
@FrankerZ 哈哈。也许其他一些进程会定期检查
usermail表...? -
用你的问题和代码澄清。在代码中添加 cmets。
-
如果您使用的是
mail(),那么您可以用逗号分隔收件人列表:johny@example.com, sally@example.com
标签: php