I’ve managed to do it but it’s… well… not very elegant.
In the backend > FC7 plugin > in Form tab, I’m placing a hidden field:
<input type="hidden" name="aux-input" id="aux-input" value=[myshortcode]>
Then, on the Mail tab, I call the field’s value. So the Subject field looks something link this:
...some text... [aux-input]
functions.php – here is what my functions.php looks like:
function printMyShortcode(){
return 'some random text';
}
add_shortcode('myshortcode','printMyShortcode');
add_filter( 'wpcf7_form_elements', 'mycustom_wpcf7_form_elements' );
function mycustom_wpcf7_form_elements( $form ) {
$form = do_shortcode( $form );
return $form;
}
Thanks for reading and I hope this helps someone.
Also, I’d be really grateful if anyone can improve the solution found! ??