我尝试编辑使用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>
请帮帮我!我无法手动将消息发送到每封电子邮件。
答案 0 :(得分:0)
尝试将收件人列表提交为多个阵列。
试试这个:
$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>"
);
替换为您实际阅读的电子邮件地址:)