I am using PHPMailer in a script like this:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
This is working, but I have another script that also needs to use it. When I attempt to redeclare it I get the following error because that file is already included...
Cannot declare class PHPMailer\PHPMailer\Exception
I want to make sure it has been declared and if not load it on this new page. I have tried this but with no luck...
if (!class_exists("PHPMailer\\PHPMailer\\Exception")) {
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
}