how can I filter before contact form 7 (wordpress) send email and later go back to my normal flow?

I am trying to do this:

Using Contact Form 7, I want to filter depending on a selectbox and send mail to one or other , I would do this sending with phpmail function…

Read More

So far I have this..

add_action( ‘wpcf7_before_send_mail’, ‘process_form’ );

function process_form( $cf7 ) {
 $submission = WPCF7_Submission::get_instance();

    if ( $submission ) {
        $posted_data = $submission->get_posted_data();
    }

    if( $cf7->id() == MYID ) {
    ... DO something
   }
}

And it works, it filters only when the ID of the form matches with MYID, but I want to return true or something and then show the normal message of “Your email has been sent” instead get stuck ont he loading gif. What kinda I do to get a “true” return or keep with the contact form 7 flow?

I obvioulsy tried with return true; At the “Do something” section I just send mail with mail(....")

Related posts

Leave a Reply

1 comment