Viewing 6 replies - 1 through 6 (of 6 total)
  • pascal.k

    (@pascalklaeres)

    Hi, I have the same problem. I can select the repeater email field in my notifications as receiver, but there were no email sended to. Presumably because the code can’t select the right email field from the selected repeater field. Is there any solution to fix this? And why does no one answer here?

    Thread Starter ultramega

    (@ultramega)

    Hi Pascal,
    I had to create a gravity hook (https://www.gravityhelp.com/documentation/article/gform_notification/) that grabbed the recipients added to the repeater field into an array then change the $notification[‘to’] variable with the recipients separated by a comma.

    It was not very clean and it can cause trouble with spam filters.

    Best Regards,
    Cedric

    pascal.k

    (@pascalklaeres)

    Thank you, that helped me! Here’s some code. It’s still expandable.

    add_filter( 'gform_notification', 'your_suffix_repeater_email_recipients', 10, 3 );
    function your_suffix_repeater_email_recipients( $notification, $form, $entry ){
    
        if ( $notification['name'] == 'Name of your email notification' ) {
    
            $repeater = unserialize($entry[115]); // Change you repeater ID
            $emails = array();
    
            foreach( $repeater as $entrys ){
                $emails[] = $entrys[121][1];  // Change you email field ID
            }
            $recipients = implode(',', $emails);
    
            $notification['toType'] = 'email'; 
            $notification['to'] = $recipients;
    
        }
    
        return $notification;
    }
    Thread Starter ultramega

    (@ultramega)

    Nice !

    That’s quite exactly what I’ve done for my problem.

    Hi,

    Tried your code but can’t make it work.

    
    add_filter( 'gform_notification', 'your_suffix_repeater_email_recipients', 10, 3 );
    function your_suffix_repeater_email_recipients( $notification, $form, $entry ){
    
        if ( $notification['name'] == 'Name of your email notification' ) {
    
            $repeater = unserialize($entry[4]); // Change you repeater ID
            $emails = array();
    
            foreach( $repeater as $entrys ){
                $emails[] = $entrys[2][1];  // Change you email field ID
            }
            $recipients = implode(',', $emails);
    
            $notification['toType'] = 'email'; 
            $notification['to'] = $recipients;
    
        }
    
        return $notification;
    }
    

    Am i doing this wrong?

    Thank you in advance.

    • This reply was modified 7 years, 2 months ago by oliversaguibo.

    You need to also input your notificaton name

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Send notifications to emails from a repeated email field’ is closed to new replies.