I feel like I am almost there. (I could be wrong though)
from the root of my apache server (/usr/local/var/www)
I ran
composer require phpmailer/phpmailer
I've now got the folder system
/usr/local/var/www/vendor/phpmailer/phpmailer
In this folder, there is a src
folder, and in that folder are basically all the files I think I need to include on the php page where I want to use PHPmailer.
On the PHP page where I want to use PHPMailer, I have at the top:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
and in the page I am calling
$mail = new PHPMailer(true); //Argument true in constructor enables exceptions
I am getting an error message
Error: Class "PHPMailer\PHPMailer\PHPMailer" not found in /usr/local/var/www/xxx.php
It seems like something isn't linking up correctly.