Home / eCommerce / Add CC Mail
Duplicate Snippet

Embed Snippet on Your Site

Add CC Mail

Adds CC to default Wordpress mailing system.

Code Preview
php
<?php
add_filter('wp_mail', 'add_cc_to_wp_mail', 10, 1);
function add_cc_to_wp_mail($args) {
    // Specify the CC email address
    $cc_email = '[email protected]';
    
    // Check if headers are an array or string
    if (is_array($args['headers'])) {
        $args['headers'][] = 'Cc: ' . $cc_email;
    } else {
        $args['headers'] .= 'Cc: ' . $cc_email . "\r\n";
    }
    
    return $args;
} 

Comments

Add a Comment