Thread Starter
e
(@xaviesteve)
Ok, finally got it. It turns out the WPCF7 thing is an Object with Arrays inside so it should be called like:
$wpcf7_data->mail['recipient'] = "Mark <mark@gmail.com>";
Hope that helps 🙂
what would you like to do with the posted data?
Thread Starter
e
(@xaviesteve)
Hi strigga,
You can do pretty much anything, some examples:
1) if the user typed in the word “support” or “help” you could change the recipient to support@company.com, but if it found “business enquiry” forward it to sales@company.com.
2) Same goes for a City field, if the user is in London you could send the email to the London branch.
3) Or if the form was submitted on a weekend, when the offices are closed, you can send a confirmation email like “Thanks for your email, unfortunately we are out of the office, will get back to you on Monday“.
4) If there is a budget field and the user types in “1,000” then forward it to sales@company.com, but if the user types in “10,000,000” then the boss will probably want to deal with that juicy client himself.
There’s plenty of examples really, the idea is to have fewer forms on the site (or even just one) which then through some smart coding can do custom actions or change certain things.
@ e
What to do when you have multiple forms (contact forms and apply forms) on you’re website? How do you determine when this function must be executed? My custom before mail send function should only be executed with the apply forms.
Thread Starter
e
(@xaviesteve)
@ toomaat
Each form has an ID: $wpcf7_data->id
so once you know the ID of the Apply forms you can put a conditional if($wpcf7_data->id == 123)
and take action only for that form
Thx!
In the mean time I also found the solution ‘how to handle with multiple forms”.