Uncaught Error: Undefined constant “PHPMailer\PHPMailer\FILTER_FLAG_SCHEME_REQUIRED”

The FILTER_FLAG_HOST_REQUIRED filter flag was deprecated in PHP 7.3 and there are no longer any references to it in the PHPMailer code base. So a straightforward fix should be to simply update PHPMailer. If you were using composer this would be automatic and very simple, but you’re not, so you’ll have to download the latest version and install it yourself as per the readme.

Fatal error: Uncaught Error: Undefined constant PHPMailer\PHPMailer\FILTER_FLAG_HOST_REQUIRED" in C:\xampp\htdocs\phpmailer\PHPMailer.php:3598 Stack trace: #0 C:\xampp\htdocs\phpmailer\PHPMailer.php(3564): PHPMailer\PHPMailer\PHPMailer::isValidHost('localhost') #1 C:\xampp\htdocs\phpmailer\PHPMailer.php(2304): PHPMailer\PHPMailer\PHPMailer->serverHostname() #2 C:\xampp\htdocs\phpmailer\PHPMailer.php(1421): PHPMailer\PHPMailer\PHPMailer->createHeader() #3 C:\xampp\htdocs\phpmailer\PHPMailer.php(1316): PHPMailer\PHPMailer\PHPMailer->preSend() #4 C:\xampp\htdocs\scripts\form.php(43): PHPMailer\PHPMailer\PHPMailer->send() #5 C:\xampp\htdocs\contact.php(3): include('C:\xampp\htdocs...') #6 {main} thrown in C:\xampp\htdocs\phpmailer\PHPMailer.php on line 3598


Leave a Reply