我一直在尝试修改此PHP代码(工作代码)以向多个收件人发送电子邮件:
if(!isset($hasError)) {
$emailTo = $contact_email;
$subject = $subject;
$body = "Name: $name \n\nEmail: $email \n\nMessage: $comments";
$headers = 'From <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
wp_mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
我的解决方案:
if(!isset($hasError)) {
$emailTo = $contact_email;
$subject = $subject;
$body = "Name: $name \n\nEmail: $email \n\nMessage: $comments";
$headers = 'From <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
$headers .= 'BCC hello@mymail.com'. . "\r\n";
//wp_mail($emailTo, $subject, $body, $headers);
wp_mail(null, $subject, $body, $headers);
$emailSent = true;
}
我的解决方案不起作用。我尝试过多种情况,但我仍然陷入困境。如何添加多个收件人?
答案 0 :(得分:0)
$headers .= 'BCC hello@mymail.com'."\r\n";
Ther是bcc行中的一个额外点。