小编DBR*_*DBR的帖子

如何将 BCC 收件人添加到 WooCommerce 发送的所有电子邮件中?

我正在尝试将密件抄送添加到 woocommerce / wp 发送的每封邮件中。我尝试使用在网络和 Stackoverflow 上找到的不同解决方案,并将片段添加到我正在使用的主题的functions.php中:

add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_admin_new_order', 10, 3 );
function add_bcc_to_wc_admin_new_order( $headers = '', $id = '', $wc_email = array() ) {
    if ( $id == 'new_order' ) {
        $headers .= "Bcc: my@mail.net\r\n";
    }
return $headers;
}
Run Code Online (Sandbox Code Playgroud)

add_filter( 'woocommerce_email_headers', 'add_bcc_all_emails', 10, 2);

function add_bcc_all_emails($headers, $object) {

    $headers = array();
    $headers[] = 'Bcc: my@mail.net';
    $headers[] = 'Content-Type: text/html';

    return $headers;
}
Run Code Online (Sandbox Code Playgroud)

add_filter('wp_mail','custom_mails', 10,1);

function custom_mails($args){
    $bcc_email = sanitize_email('my@mail.net');

    if (is_array($args['headers'])){
        $args['headers'][] = 'Bcc: '.$bcc_email ; …
Run Code Online (Sandbox Code Playgroud)

email wordpress events bcc woocommerce

5
推荐指数
1
解决办法
7158
查看次数

标签 统计

bcc ×1

email ×1

events ×1

woocommerce ×1

wordpress ×1