Alternate recipient
-
Hi there,
I need to change alternate the recipients to my contact form, so I wrote some code, but the contact form is not sent. Nothing happens…
Any clue someone ?function wpcf7_do_something (&$WPCF7_ContactForm) { $emailpick = $wpdb->get_var("SELECT numberofsent FROM wp_mailsent WHERE ID ='1' "); if ($emailpick == 0 ) { $mail = $contact_form->prop( 'mail' ); $mail['recipient'] = "Mike <[email protected]>"; $contact_form->set_properties( array( 'mail' => $mail ) ); } else{ $mail = $contact_form->prop( 'mail' ); $mail['recipient'] = "Mikebis <[email protected]>"; $contact_form->set_properties( array( 'mail' => $mail ) ); } if ($emailpick == 1 ){ $emailpick == 0; } else {$emailpick == 1;} $wpdb->update($wpdb->mailsent, array("numberofsent" => $emailpick), array("ID" => 1)); } add_action("wpcf7_before_send_mail", "wpcf7_do_something");
The topic ‘Alternate recipient’ is closed to new replies.