Description
This filter is executed before sending the user notification email. It can be used to route the notification to a different email address.
Usage
Applies to all forms
add_filter( 'gform_autoresponder_email', 'change_notification_email', 10, 2 );Applies to a specific form. In this case, form Id 5
add_filter( 'gform_autoresponder_email_5', 'change_notification_email', 10, 2 );Parameters
- $email stringThe email address to be filtered.
- $form Form Object
The current form.
Examples
This example uses the gform_autoresponder_email filter to send the user notification to a test email address
add_filter( 'gform_autoresponder_email', 'change_notification_email', 10, 2 ); function change_notification_email( $email, $form ) { //applying notification routing to form Id 2 if ( $form['id'] != 2 ) return $email; //creating email list from fields 2 and 3. return $_POST['input_2'] . ',' . $_POST['input_3']; }Source Code
This filter is located in GFCommon::prepare_user_notification() in form_display.php