Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save divienginesupport/0a10025e112ae118875a9f4703135f8f to your computer and use it in GitHub Desktop.
Save divienginesupport/0a10025e112ae118875a9f4703135f8f to your computer and use it in GitHub Desktop.
function custom_contact_recipient( $mail_to, $form_id, $form_data ) {
// Enter your form ID here
if ( $form_id == 'add_post_form' ) {
// These are the field conditions. We enter the field ID here and the expected value
// First condition checks if the Department field is equal to Sales and the Products field is equal to Form Builder
if ( $form_data['department'] == 'Sales' && $form_data['products'] == 'Form Builder' ) {
$mail_to = '[email protected]';
} else if ( $form_data['department'] == 'Sales' && $form_data['products'] == 'Bodycommerce' ) {
$mail_to = '[email protected]';
} else if ( $form_data['department'] == 'Support' && $form_data['products'] == 'Form Builder' ) {
$mail_to = '[email protected]';
} else if ( $form_data['department'] == 'Support' && $form_data['products'] == 'Bodycommerce' ) {
$mail_to = '[email protected]';
}
} else if ( $form_id == 'second_form_id' ) {
// These are the field conditions. We enter the field ID here and the expected value
// First condition checks if the Department field is equal to Sales and the Products field is equal to Form Builder
if ( $form_data['day'] == 'Monday') {
$mail_to = '[email protected]';
} else if ( $form_data['day'] == 'Tuesday') {
$mail_to = '[email protected]';
}
return $mail_to;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment