I’m using wp_mail filter function.
add_filter('wp_mail','check_the_mail_content');
If my condition satisfied then the mail should go, otherwise I need to stop, my function is
add_filter('wp_mail','check_the_mail_content');
function check_the_mail_content($query){
if(mycondition){
//mail should go.
}
else{
//stop the mail.
}
}