Skip Navigation

[Resolved] How to include BCCs on post form notifications

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 8.05 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 3 months, 4 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2633717

I have this as example entered in the field (Send notification to specific email address).
person1@sample.org, bcc:person2@gmail.com, person3@gmail.com

All 3 people get the email, but the last two should be BCC so that the first person doesn't see them on the to line.

What am I doing wrong

#2633791

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Thank you for contacting our support.

You need to use a hook, cred_notification_recipients, to include the BCC addresses.

More info on about the hook is available here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients.

Please check the example:

/**
 * Customize CRED notification recipients by adding a BCC 
 * to the the notification "Content submitted"
 */
add_filter('cred_notification_recipients', 'modify_recipients', 10, 4);
function modify_recipients($recipients, $notification, $form_id, $post_id) {
 
    // Check notification name matches target notification
    if ( isset($notification['name']) && 'Content submitted' == $notification['name'] ) {
 
        // Add a BCC to person3@gmail.com
        $recipients[] = array(
            'to'        =>  'bcc',
            'address'   => 'person3@gmail.com',
            'name'      =>  '',
            'lastname'  =>  ''
            );
    }
          
    return $recipients;
}

Here are a few other similar examples for you to base on:

https://toolset.com/forums/topic/syntax-for-notification-email-to-bcc/page/2/#post-2498081
https://toolset.com/forums/topic/ive-got-to-go-to-sleep-but-need-someone-to-work-on-existing-tickets/#post-1871519

Please give it a try and tell us the results.

Best regards,

Mateus

#2634803

I didn't have a chance to review or implement this solution.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.