PHP cannot use a provided class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
  php v5.6.34

  I am working on a very simple PHPMailer; all it has to do is send an
email. I am using the latest version from the Github repository, v6.0.3.
  Running the program produces this:

Fatal error: Class 'PHPMailer' not found in
/home/sohne/web/php/common/php-test-email.php on line 44

  The program obviously loads the class files; there is no error there.
Yet trying to create a new instance fails.

  What am I missing?

----[ The start of the program ]----
    define('PHP_COMMON', '/home/sohne/web/php/common/');

    require(PHP_COMMON . 'phpmailer-603/PHPMailer.php');
    require(PHP_COMMON . 'phpmailer-603/Exception.php');
    require(PHP_COMMON . 'phpmailer-603/SMTP.php');

    //Import the PHPMailer class into the global namespace
    // use PHPMailer\PHPMailer\PHPMailer;

    $from = 'sma.info@xxxxxxxxxxxxxx';

    $to = $sendto;
    $replyto = 'moe.james@xxxxxxxxxxxxxx';
    $cc = '';
    $bcc = '';

    // use PHPMailer;

    $mail = new PHPMailer();
**Splat!**
----[ end ]----


  This is the head portion of the PHPMailer Class:

namespace PHPMailer\PHPMailer;
class PHPMailer
{
  ---- the rest of the class ---
}

-- 
James Moe
jmm-list at sohnen-moe dot com
Think.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux