Capture email body as variable from wpcf7_mail_sent hook
-
I am trying to capture the completed email message body as a variable using a function created from the hook: wpcf7_mail_sent
The pre-completed body looks like this:
Message Body: [your-message] [your-name]
The completed body should look something like this (variables filled in by form input fields):
Message Body: asdfasdf qwerqwer
It seems that because the class WPCF7_Mail function compose is private I cannot access the completed variable.
This is the current direction I was heading in, however it only returns the pre email body and not the submitted variables:
add_action('wpcf7_mail_sent', 'cf7pp_after_send_mail'); function cf7pp_after_send_mail( $contact_form ) { $array = (array) $contact_form; $values = array_values ($array); $body = $values[3]['mail']; echo "<pre>"; print_r ($body); }
Can anyone point me in the right direction on how to do this?
Thanks,
Scott
- The topic ‘Capture email body as variable from wpcf7_mail_sent hook’ is closed to new replies.