Hi,
This plugin only creates the additional form parts for extra emails by duplicating what the original plugin uses in email (2). Since that does not have such conditional sending, nor do the extra ones. It’s not something I plan on building into this.
However, there is a filter called wpcf7_additional_mail
in submission.php
that can be used to inspect the current form submission and conditionally remove messages from that array.
The problem you’re describing isn’t necessarily a multiple emails issue. Wouldn’t it make more sense to send one email, but change its content and the set of attached files? That is also possible by using the filter/action hooks in CF7 and using add_extra_attachments()
.
Regards.
Thread Starter
pkon
(@pkonings)
Hi Roy,
Thank you for taking the time to respond.
I think what you are suggesting would surely work and is even more elegant of a solution. However i’m not able to write a function code like that myself.
With your clue’s, I might dip my toes into it someday and try to create somekind of code.
For now the search goes on. 🙂
Kind Regards
Hire someone. It’s explained in this blog post, the form could have a checkbox set like this:
[checkbox* interests use_label_element "a|Subject A" "b|Subject B" "c|Subject C"]
Then something like this as the body of your custom plugin:
add_action(
'wpcf7_before_send_mail',
function($contact_form, &$abort, $submission) {
$interests = (array) $submission->get_posted_data('interests');
if (in_array('a', $interests))
$submission->add_extra_attachments('path/to/info-a.pdf');
...
},
10,
3,
);