PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home2/medicu/.trash/disable-mail/
Server: Linux tista.bd.svlogins.com 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
IP: 103.159.37.114
Choose File :

Url:
Dir : /home2/medicu/.trash/disable-mail/disable-mail.php

<?php
/**
 * Plugin Name: Disable Default Mail
 * Plugin URI:  https://yourwebsite.com/
 * Description: Completely disables the default WordPress local mailing system (PHP Mail) to prevent unauthorized/automated emails from the server. Only authenticated SMTP connections are allowed.
 * Version:     1.0.0
 * Author:      Advaxe
 * Author URI:  https://yourwebsite.com/
 * License:     GPL2
 */

// Exit if accessed directly to ensure security.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * 1. Block local mail execution in PHPMailer.
 * We use PHP_INT_MAX priority to ensure this runs AFTER WooCommerce, CartFlows, 
 * and any SMTP plugins have tried to configure PHPMailer.
 */
add_action( 'phpmailer_init', 'advaxe_block_local_php_mail', PHP_INT_MAX );

function advaxe_block_local_php_mail( $phpmailer ) {
    // Check if the mailer is set to 'smtp'. Authentic SMTP plugins will change this to 'smtp'.
    // If it is 'mail' or 'sendmail' (which cPanel uses locally), we intercept and block it.
    if ( $phpmailer->Mailer !== 'smtp' ) {
        
        // Clear all recipients and attachments so the email has nowhere to go
        $phpmailer->clearAllRecipients();
        $phpmailer->clearAttachments();
        $phpmailer->clearBCCs();
        $phpmailer->clearCCs();
        $phpmailer->clearReplyTos();

        // Change the mailer to a non-existent protocol. 
        // This completely stops the native PHP mail() function from executing via WordPress.
        $phpmailer->Mailer = 'disabled_by_advaxe';
    }
}