WordPress preprocess_comment hook not firing

I have a comment form on my wordpress website and I am trying to get the following to happen:

1) on the click of post comment get the data
2) if the required field is set to yes, send email

Read More

For some reason it is not working, here is my code:

function preprocess_comment_handler( $commentdata ) {

    mail('mail@example.com','subject','message');

   if ($commentdata['signuptomailinglistcommentform'] == "Yes") {
       mail('mail@example.com','subject','message');
   }

//some code
//return $commentdata;
}
add_filter( 'preprocess_comment' , 'preprocess_comment_handler' );

I even added mail(‘mail@example.com’,’subject’,’message’); above the if function so that it should just run the moment I the hook is called yet there is still nothing :/

any ideas?

Related posts