php – Getting an error when calling a method from another class-ThrowExceptions

Exception or error:
require_once 'dbconfig.php';
class USER {

  function send_mail($email,$message,$subject) {

    require_once('mailer/class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->IsSMTP(); 
    $mail->SMTPDebug  = 0;                     
    $mail->SMTPAuth   = true;                  
    $mail->SMTPSecure = "ssl";                 
    $mail->Host       = "mail.smeinfratech.co.za";      
    $mail->Port       = 465;             
    $mail->AddAddress($email);
    $mail->Username="datalogging@smeinfratech.co.za";  
    $mail->Password="********";            
    $mail->Send();

  }
}

That’s the first class and then I want to call the send_mail method in the following page

initVariables();

$userEmail = 'blank';
$SYSID = 'blank';
$SYSTEM = 'blank';
$userID = 'blank';

echo($userEmail);
require_once 'dbconfig.php';
require_once 'class.user.php';

$user = new USER();

$user->send_mail("dataloggingtest@smeinfratech.co.za", "TEST", "TEST");

The $user = new USER(); line causes my page not to load.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *