Contact Form 7 pre email processing [closed]

Contact form 7 changed classes in 3.9 version. Now this is how it goes.

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() == 20 ) {
        $wpdb->insert('newsletter_signups',
            array(
                'name' => $posted_data['name'],
                'email' => $posted_data['email']
            )
        );
    }
}

Read more about change here.

tech