Conditional “Send To” email address
-
Hello,
I’ve got a form that I want to send to alternating email addresses, so that every second email goes to a alternative email address.
I installed Flamingo so that I could use [_serial_number] to check if Serial Number was an even number or an odd number and if the Serial Number is odd, the $receipient field is changed to the alternative email address.
This is the code snippet that I’m using but it never “reads” the [_serial_number] so the $receipient field never gets updated.
add_action( 'wpcf7_before_send_mail', 'set_recipient', 10, 1 );
function set_recipient($instance) {
$properites = $instance->get_properties();
if($properites['_serial_number']%2==0) {
$properites['mail']['recipient'] = [email protected];
} else {
$properites['mail']['recipient'] = [email protected];
}
$instance->set_properties($properites);
return ($instance);
}Can you tell me what is the correct format for accessing the [_serial_number] so that I can check if it’s odd or even?
Thanks in Advance,
Donal
The topic ‘Conditional “Send To” email address’ is closed to new replies.