How to add cc bcc in wordpress mail

In WordPress, you can add CC and BCC recipients to the email notifications sent by your site using the wp_mail function or a plugin. Here are a few methods:

Method 1: Using wp_mail function

You can modify the wp_mail function to add CC and BCC recipients by using the wp_mail filter. Add the following code to your theme's functions.php file:

function add_cc_bcc_to_wp_mail($args) {
    $cc = array('[email protected]', '[email protected]'); // Add CC recipients here
    $bcc = array('[email protected]', '[email protected]'); // Add BCC recipients here
    $args['cc'] = implode(',', $cc);
    $args['bcc'] = implode(',', $bcc);
    return $args;
}
add_filter('wp_mail', 'add_cc_bcc_to_wp_mail');

In this example, we're adding two CC recipients and two BCC recipients. You can modify the arrays to add more recipients.

Method 2: Using a plugin

There are several plugins available that allow you to add CC and BCC recipients to WordPress email notifications. Here are a few popular ones:

  1. WP CC and BCC: This plugin allows you to add CC and BCC recipients to email notifications sent by your site. You can configure the plugin to add recipients based on user roles, post types, or custom conditions.
  2. Email CC and BCC: This plugin provides a simple way to add CC and BCC recipients to email notifications. You can add recipients manually or use a custom field to populate the CC and BCC lists.
  3. WP Mail SMTP: This plugin allows you to customize the email notifications sent by your site, including adding CC and BCC recipients.

Method 3: Using a theme-specific solution

Some WordPress themes, such as Genesis or Thesis, provide built-in support for adding CC and BCC recipients to email notifications. Check your theme's documentation to see if it provides a solution for adding CC and BCC recipients.

Remember to test your email notifications after implementing any of these methods to ensure that the CC and BCC recipients are being added correctly.