Adding extra content in Mail Body Dynamically
-
Hi
I want to add some extra content to the mail body before sending the mail but I am not able to do that.
Here is the code that I am using :
function wpcf7_do_something($WPCF7_ContactForm){ $cf7_shortcode = !empty(get_option('cf7_shortcode')) ? get_option('cf7_shortcode') : ''; $_id = explode("=", $cf7_shortcode); $id_ = explode(" ",$_id[1]); $id = explode('"', $id_[0]); if( $WPCF7_ContactForm->id() == $id[1] ): $wpcf7 = WPCF7_ContactForm::get_current(); $submission = WPCF7_Submission::get_instance(); if ($submission) { if (empty($data)) return; $mail = $wpcf7->prop('mail'); substr_replace($mail['body'], 'something', 0, 0); } return $wpcf7; endif; //var_dump($WPCF7_ContactForm); } add_action("wpcf7_before_send_mail", array($this,'wpcf7_do_something') );
I have checked that it is going into the if condition.
What am I missing in my code or what should do to add content dynamically ?
- The topic ‘Adding extra content in Mail Body Dynamically’ is closed to new replies.