您可以使用数组发送所需的所有信息,因此:
$headers[] = 'From: Test <info@test.co.uk>';
$headers[] = 'Cc: copy_to_1@email.com';
$headers[] = 'Cc: copy_to_2@email.com';
...
$headers[] = 'Bcc: bcc_to_1@email.com';
$headers[] = 'Bcc: bcc_to_2@email.com';
$success = wp_mail( $emails, $subject, $message, $headers );
您可以通过编程方式获取它,在通过您在内部字段文本中声明的逗号拆分它们并定义数组后,成为所述表单字段的数组和数组:$copy_to
$bcc_to
$headers
$headers[] = 'From: Test <info@test.co.uk>';
foreach($copy_to as $email){
$headers[] = 'Cc: '.$email;
}
foreach($bcc_to as $email){
$headers[] = 'Bcc: '.$email;
}
$success = wp_mail( $emails, $subject, $message, $headers );