Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Send a copy of every message to admin


  • ARCangelGIRL
    Participant

    @arcangelgirl

    Hello,

    Is it possible to send a copy of all the messages that were send in a site to the site administrator or selected email?

    Any ideas or snippets how to achieve that?

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    Try this, replace the Bcc with your email:

    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' );

    ARCangelGIRL
    Participant

    @arcangelgirl

    This works just perfect, thank you! 🙂


    ARCangelGIRL
    Participant

    @arcangelgirl

    This line should look like this. [] caused problem user at registration, so I removed it
    $args['headers'] = 'Bcc: <admin@yoursite.com>';

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Send a copy of every message to admin’ is closed to new replies.
Skip to toolbar