use*_*134 9 php email wordpress
我想将以下字段发送到wp_mail
如果我把所有的电子邮件Email to
,Copy to
并Bcc to
在一个数组$emails
并把它传递给wp_mail.如何在wp_mail中设置cc和bcc的标头?
$headers = 'From: Test <info@test.co.uk>' . '\r\n';
$headers.= 'Content-type: text/html\r\n';
$success = wp_mail( $emails, $subject, $message, $headers );
Run Code Online (Sandbox Code Playgroud)
Dez*_*Dez 15
您可以使用数组发送所需的所有信息,因此:
$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 );
Run Code Online (Sandbox Code Playgroud)
您可以通过编程方式获取它,$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 );
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10605 次 |
最近记录: |