If you need to stop email notifications based on a submitted field value, you may use the af/form/email/recipient filter to override the recipient list based on the form's configuration args. A return value of FALSE will disable the notification email.
<?php function conditionally_send_email( $recipient, $email, $form, $fields ) { // Check for correct form. if ( $form['key'] !== 'FORM_KEY' ) { return $recipient; } // If submitted field value doesn't match the expected value, return FALSE to stop email sending. if ( af_get_field( 'my_field_name' ) !== 'some value' ) { return FALSE; } return $recipient; } add_filter( 'af/form/email/recipient', 'conditionally_send_email', 10, 4 );
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article