I'm working on a project that will send mail using PEAR::Mail (which I have found to be more reliable than PHPMailer or other approaches). I want to have a prerequisite-checking script check if this PEAR module is installed. So far this is what I've come up with:
// turn off warnings and notices so they don't muck up the formatting of our output.
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
// this will list any thing we need to install.
$missing_components = array();
// check for PEAR Mail
include_once "Mail.php"; // this would ordinarily throw an E_WARNING
if (!class_exists("Mail")) {
$missing_components[] = "PEAR::Mail";
}
My problem is that this script will only check for the existence of any class named 'Mail.' Can anyone suggest a better way to make sure it's PEAR::Mail and not just any class called Mail?