Written by James McDonald

August 24, 2021

The Divi contact form allows you to send to multiple email addresses by opening the properties of the form and entering multiple comma separated email addresses but they end up all in the To: field

Adding BCC to Emails using a functions.php Snippet

You need to edit your functions.php and add the below code. functions.php is located under wp-content/themes/<theme_name>/

# if using Divi without a child theme
wp-content/themes/Divi/functions.php

# if using child theme example
wp-content/themes/divi-child/functions.php
<?php

add_filter('wp_mail', 'custom_mails', 10, 1);

function custom_mails($args)
{
    $bccEmail = sanitize_email('[email protected]');

    if (is_array($args['headers'])) {
        $args['headers'][] = 'Bcc: ' . $bccEmail;
    } else {
        $args['headers'] .= 'Bcc: ' . $bccEmail . "\r\n";
    }

    return $args;
}

This is the original website I got this code from:

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...