使用数据库中数据的电子邮件服务


Email service using data from database

尝试从数据库的联系人列表发送电子邮件,但它不发送。

<?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' . "'r'n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";
        $headers .= "From: info@grillontherock'r'n";
            
            
        $to = "$email";
        $subject = "";
        
        $mail_result = mail($to, $subject, $mail_body, $headers);
        
?>

我尝试了很多不同的方法,但我不知道如何发送多封电子邮件。

您内爆了一组收件人:

$recipients=数组('hassan@gmail.com','jill@gmail.com');

邮件(内爆(',',$to),$submit,$message,$headers);请参阅PHP:Mail函数参考-http://php.net/manual/en/function.mail.php

一个或多个收件人。

此字符串的格式必须符合»RFC 2822。例如: