• Hello,

    I’m managing some wordpress sites. And recently some of the sites started showing the message “There has been a critical error on the website”. The websites showing the messages are all on PHP 8.0 and by default, the PHP mail function is disabled for all PHP versions. Interestingly these websites have a common plugin “better-wp-security” (https://en-ca.wordpress.org/plugins/better-wp-security/) installed. The error disappears if I switch the version to PHP 7.4 or less. Hope someone from plugin support can help me here. On inspecting the sites have the following message on the PHP error log.

    `

    PHP Fatal error:  Uncaught Error: Call to undefined function PHPMailer\PHPMailer\mail() in /home/USERNAME/public_html/wp-includes/PHPMailer/PHPMailer.php:874
    Stack trace:
    #0 /home/USERNAME/public_html/wp-includes/PHPMailer/PHPMailer.php(1902): PHPMailer\PHPMailer\PHPMailer->mailPassthru('noreply@riicon....', '[safeharbourepr...', '\r\n<!DOCTYPE htm...', 'Date: Fri, 12 N...', NULL)
    #1 /home/USERNAME/public_html/wp-includes/PHPMailer/PHPMailer.php(1642): PHPMailer\PHPMailer\PHPMailer->mailSend('Date: Fri, 12 N...', '\r\n<!DOCTYPE htm...')
    #2 /home/USERNAME/public_html/wp-includes/PHPMailer/PHPMailer.php(1473): PHPMailer\PHPMailer\PHPMailer->postSend()
    #3 /home/USERNAME/public_html/wp-includes/pluggable.php(542): PHPMailer\PHPMailer\PHPMailer->send()
    #4 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/lib/class-itsec-mail.php(624): wp_mail(Array, '[safeharbourepr...', '\n<!DOCTYPE html...', Array, Array)
    #5 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/modules/notification-center/class-notification-center.php(532): ITSEC_Mail->send()
    #6 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/notify.php(218): ITSEC_Notification_Center->send('digest', Object(ITSEC_Mail))
    #7 /home/USERNAME/public_html/wp-includes/class-wp-hook.php(303): ITSEC_Notify->send_daily_digest(false, 1625076941, Array)
    #8 /home/USERNAME/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters(false, Array)
    #9 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/modules/notification-center/class-notification-center.php(821): apply_filters('itsec_send_noti...', false, 1625076941, Array)
    #10 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/modules/notification-center/class-notification-center.php(771): ITSEC_Notification_Center->send_scheduled_notification('digest')
    #11 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/modules/notification-center/class-notification-center.php(742): ITSEC_Notification_Center->send_scheduled_notifications(Array)
    #12 /home/USERNAME/public_html/wp-content/plugins/better-wp-security/core/modules/notification-center/class-notification-center.php(698): ITSEC_Notification_Center->check_notification_schedule_accurate(Array)

    `

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi manumr1991,

    the PHP mail function is disabled for all PHP versions

    How exactly is that done ?

    +++++ To prevent any confusion, I’m not iThemes +++++

    Thread Starter manumr1991

    (@manumr1991)

    Hello nlpro,

    It’s a cPanel server. I have disabled it globally for all PHP versions using the MultiPHP editor by putting it inside the “disbaled_functions” directive

    Ok, so that means the PHP mail() function cannot be used.

    However the iTSec plugin uses the WordPress wp_mail() function to send emails.

    And since the WordPress wp_mail() function normally uses the PHP mail() function to send emails it’s to be expected to receive the fatal error (unregardless of PHP version being used).

    Only switching to sending emails using SMTP will prevent the error from occurring.

    So basically IMHO this is not an iTSec plugin issue.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Critical error on website’ is closed to new replies.