External Library

Can someone please tell me how to properly use external libraries. From what I found in the forums you have to:

  1. Use the tools/external libraies
  2. create your libray
  3. Upload the php files

I completed all the above.

I know that SC provides mail macros, but I am just using the PHPMailer to learn how to use external libraries.

I created a blank app an using this code to test in the “onExecute” Event.

sc_include_library(“prj”,“phpmailer”,“phpmailer.php” , “true”, “true”); <-- no problem, finds the file
$mail = new PHPMailer; <-- Get the error below

error:

Class ‘PHPMailer’ not found

What step am I missing???

I use these settings if I show only lines identical to yours:

sc_include_library(“prj”, “PHPMailer”, “src/PHPMailer.php”, true, true);
sc_include_library(“prj”, “PHPMailer”, “src/Exception.php”, true, true);
sc_include_library(“prj”, “PHPMailer”, “src/SMTP.php”, true, true);

$mail = new PHPMailer\PHPMailer\PHPMailer;

[LEFT][SIZE=13px]Thank you rik! I modified my code to use the namespace and it works now. The namespace is what I was missing. A newbie mistake.[/SIZE][/LEFT]