Saltar navegación

[Resuelto] How to include BCCs on post form notifications

This support ticket is created hace 1 año, 4 meses. There's a good chance that you are reading advice that it now obsolete.

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.

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)

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Mateus Getulio hace 1 año, 4 meses.

Asistido por: Mateus Getulio.

Autor
Mensajes
#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

Idiomas: Inglés (English )

Zona horaria: 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.