drj14664
drj14664
2015-11-20 11:47

使用php邮件向多封电子邮件发送消息

  • php

I have a table below in MYSQL

Mmeber_Email---------------Member_Name------Data---
mike01@yahoo.com  --------  Mike ---------- 100 ------
jacknick@gmail.com  --------Jack -----------50 ----
jillwag@hotmail.com  -------Jill ---------- 75 ------
jnash@gmail.com  --------   John ---------- 10 ------

Now, I have managed to extract the data from the database using PHP. but i don't know how to email the data of each member on their respective email using PHP Mail function. How should i tackle the problem of sending emails to multiple recipients using the PHP mail function below i.e Mike Should get the email containing the message 100, Jack 5 and so on..

<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = //data extracted from database using a common query comes here
$headers = "From: webmaster@example.com";

mail($to,$subject,$txt,$headers);
?>
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答