This question already has an answer here:
Trying to send email from the contact list from phpmyadmin and it does not send.
<?php
include_once "../../mysqli_connect.php";
$sql= mysqli_query($dbc, "SELECT * FROM Customer_Info");
while($row= mysqli_fetch_array($sql)){
$email = $row["email"];
$mail_body = file_get_contents('../forms/promo_email_form.html');
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= "From: info@grillontherock
";
$to = "$email";
$subject = "";
$mail_result = mail($to, $subject, $mail_body, $headers);
?>
I have tried many different ways but I have no idea how to send multiple emails.
Thanks.
</div>
You implode an array of recipients:
$recipients = array('hassan@gmail.com', 'jill@gmail.com');
mail(implode(',', $to), $submit, $message, $headers); See the PHP: Mail function reference - http://php.net/manual/en/function.mail.php
Receiver, or receivers of the mail.
The formatting of this string must comply with » RFC 2822. Some examples are: