Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to stop all email functionality in my wordpress installation.

Is this possible with a global flag?

or maybe by forbidding this installation to use the php mail function at all in htaccess?

share|improve this question

2 Answers 2

Please refer below link. It will may help you.

https://gist.github.com/davejamesmiller/1966437

share|improve this answer

Below function is less offensive than overriding wp_mail(), and allows you to add extra logic when the emails should be disabled

function childtheme_no_emails( &$phpmailer ) {
    // Empty out the values that may be set
    $phpmailer->ClearAllRecipients();
    $phpmailer->ClearAttachments();
    $phpmailer->ClearCustomHeaders();
    $phpmailer->ClearReplyTos();
}
add_action( 'phpmailer_init', 'childtheme_no_emails', 99, 1 );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.