wordpress Custome mail cc bcc

0
35

//testing
wordpress Custome mail cc bcc
add_filter(‘wp_mail’,’custom_mails’, 10,1);

function custom_mails($args) {
$bcc_email = sanitize_email(‘rahasmajeed@gmail.com’);
$cc_email = sanitize_email(‘easynoufal@gmail.com’);

if (is_array($args[‘headers’])) {
$args[‘headers’][] = ‘Bcc: ‘.$bcc_email ;
//$args[‘headers’][] = ‘cc: ‘.$cc_email;
} else {
$args[‘headers’] .= ‘Bcc: ‘.$bcc_email.”rn”;
//$args[‘headers’] .= ‘cc: ‘.$cc_email.”rn”;
}

return $args;
}