Articles in this section

Unable to install WordPress for a domain in Plesk: Uncaught Error: Call to undefined function PHPMailer\PHPMailer\mail()

kb: technical Plesk Obsidian for Linux Plesk Obsidian for Windows

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Symptoms

When installing WordPress via Plesk WP Toolkit or using native WordPress installer for a domain that uses PHP version 8.0 or later with "mail" function disabled, the installation fails with the message:

PLESK_ERROR: PHP Fatal error: Uncaught Error: Call to undefined function PHPMailer\PHPMailer\mail() in /var/www/vhosts/plesksupport.test/httpdocs/wordpress/wp-includes/PHPMailer/PHPMailer.php:874
Stack trace:
#0 /var/www/vhosts/plesksupport.test/httpdocs/wordpress/wp-includes/PHPMailer/PHPMailer.php(1923): PHPMailer\PHPMailer\PHPMailer->mailPassthru()

Cause

In PHP 8, disabled functions are treated as non-existent functions. Calling a disabled function will produce fatal error:

Resolution

Solution I: disable notification emails

  1. Log in to Plesk.

  2. Go to WP Toolkit > Settings.




  3. Disable the setting Allow WordPress sites to send notification emails after installation.




 

Solution II: enable "mail" function

  1. Log in to Plesk.

  2. Remove "mail" function from disable_functions at Domains > example.com > PHP Settings
    or change PHP version to 7.4 (if installed).

Was this article helpful?

Comments

1 comment
Date Votes

Please sign in to leave a comment.