To quickly install Composer in the current directory, run the following script in your terminal. To automate the installation, use the guide on installing Composer programmatically.
#cd /var/www/html
#php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
#php -r "if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"If the result Installer corrupt, visit https://getcomposer.org/download/
#php composer-setup.php
#php -r "unlink('composer-setup.php');"Most likely, you want to put the composer.phar into a directory on your PATH, so you can simply call composer from any directory (Global install)
#mv composer.phar /usr/local/bin/composer
Install PHPMAILER
#composer require phpmailer/phpmailer