There is a shortcut method to change email recipient when contact form is submitted.
Add below code in functions.php. It will change email recipient for contact form 7.
// hook into wpcf7_before_send_mail add_action( 'wpcf7_before_send_mail', function($contact_form){ // create new instance of WPCF7_Submission class $submission = WPCF7_Submission::get_instance(); // email address you want to change $toEmail = 'abc@xyz.com'; // set the email address to recipient $mailProp = $contact_form->get_properties('mail'); $mailProp['mail']['recipient'] = $toEmail; // update the form properties $contact_form->set_properties(array('mail' => $mailProp['mail'])); });
8 responses to “Contact Form 7 – Change Email Recipient”
Thanks for sharing ! but i dont know y contact form 7 plugin dont works for me !
After activation of contact form 7 plugin what problems you are facing?
Which one is better: or Freedom Contact Form 7 or WPForms ?
how to add a contact form on blogger
Thanks for sharing ! facing problem with this please help..
cotnact 7 form pluging not working..
Hi, thanks for sharing.
How can I send same mail to multiple recipients ?
Thank you
did you get an answer? i need it also
multiple recipients ? some one??