Parse mail tags programmatically
-
Hi all,
I want to parse (and maybe send) a mail with the content of a CF7 mail programmatically after a form was submitted.
I have this so far:
$submitId = '13659'; $formData = get_post_meta( $submitId, 'data', true ); //get submitted data $form_id = '1267'; $wpcf7 = WPCF7_ContactForm::get_instance( $form_id ); //get the form if( $wpcf7 ) { $props = $wpcf7->get_properties(); //get all props. from the form $dataArr = json_decode( $formData, true ); if( $props['mail']['active'] ) //check if mail is active { //do the magic on the body part with the submitted content //something like: //$props['mail']['body'] = wpcf7_parse_tags( $props['mail']['body'], $dataArr ); } }I mean, I could use 3 x foreach to replace all tags, but there will be tags missing like [_site_admin_email], [_site_title], …
Maybe someone has done something similar so far and can help me a bit or give me a hint.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Parse mail tags programmatically’ is closed to new replies.