multi recepients php mailer


multi recepients php mailer

我尝试编辑使用 PostageAPP.com API调用的PHP群发邮件程序。

但是,当我向 2 个收件人发送测试邮件进行测试时,他们会看到彼此的电子邮件地址。

在文档网站上,他们说:

作为一个数组。这样,收件人只能看到自己的电子邮件地址:

"收件人" : ["recipient_1@example.com", "recipient_2@example.com"]

但我想这不是用 PHP 写的。

默认的 php 代码是:

function some_func() {
    $to = array($_POST['email'] => array('name' => $_POST['variable']));
        
    # The subject of the message
    $subject = $_POST['subject'];
    # Setup some headers
    $header = array(
        'From'      => 'test@email.com',
        'Reply-to'  => 'info@email.com'
    );
    # The body of the message
    $mail_body = 'sample_parent_layout';
    # Send it all
    $response = PostageApp::mail($to, $subject, $mail_body, $header);
    return $response;
}
if (isset($_POST['email']) && $_POST['email'] !='') {
    # Processes the form if the email has been entered (see below)
    $response = process_submited_form();
}
$api_key = (POSTAGE_API_KEY == 'ENTER YOUR API KEY HERE') ? null : POSTAGE_API_KEY

我过去电子邮件列表的 html 表单:

<label> To
    <td width="41%"><font size="-3" face="Verdana, Arial, Helvetica,sans-serif">
    <textarea name="email" cols="30" rows="10"></textarea>
</label>

请帮帮我!我无法手动将邮件发送到每封电子邮件。

尝试以多阵列形式提交收件人列表。

试试这个:

$to = array(
      "recipient1@example.com" => array( "name" => "John Doe" ),
      "recipient2@example.com" => array( "name" => "Jim Doe" )
);

或者那个

$to = array(
      "John Doe <recipient1@example.com>",
      "Jim Doe <recipient2@example.com>"
);

替换为您实际阅读:)的电子邮件地址