I used Dinesh's answer, but it stopped working for me. Instead, I am now checking a field that is unique to the form I submit:
add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' ); function wpcf7_add_text_to_mail_body($contact_form){ $submission = WPCF7_Submission::get_instance(); $posted_data = $submission->get_posted_data(); if( !empty($posted_data["dealer_email"])){
Be sure to include at least one unique form name in each of the forms that you can use to do this. Perhaps it is still possible to get the form identifier from $ contact_form via a function, but it worked, and I was pleased with the result.
Jarom source share