I have an online learning site and I need to be able to receive a copy of the email a student (user) sends to the instructor (another user). I found this code but have no idea which file to paste it in. Some guidance (file name and place in the file) greatly appreciated! This code is from earlier reply 2 years ago: https://buddypress.org/support/topic/send-a-copy-of-every-message-to-admin/
My WordPress version is 4.9.2 and BuddyPress version is 2.9.2
function arc_wp_mail_filter( $args ) {
$args[‘headers’][] = ‘Bcc: <admin@yoursite.com>’;
$new_wp_mail = array(
‘to’ => $args[‘to’],
‘subject’ => $args[‘subject’],
‘message’ => $args[‘message’],
‘headers’ => $args[‘headers’],
‘attachments’ => $args[‘attachments’]
);
return $new_wp_mail;
}
add_filter( ‘wp_mail’, ‘arc_wp_mail_filter’ );