Hook into wordpress send email function
//********************************************
//********************************************
//********** FILTER OUTGOING EMAILS **********
//********************************************
//********************************************
//Any plugin or theme sending email is likely to be using wp_mail() to do it
add_filter( 'wp_mail', 'filter_wp_mail' );
function filter_wp_mail( $args )
{
//$args Fields:
// $args['to']
// $args['subject']
// $args['message']
// $args['headers']
// $args['attachments']
//----- FILTER OUT EMAILS SENT BY DIVI CONTACT FORM -----
//if (strpos($args['subject'], 'New Message From') !== False)
if (strpos($args['to'], '[email protected]') !== False) //<We set the email address to this so we can trap them here
{
$args['to'] = ""; //Remove the 'to' field to stop the email being able to be sent
}
return ($args);
}
