Introduction
This article explains how to send emails with a PHP application using PHPMailer. Before doing so, however, you must use Composer to download PHPMailer and automatically create an autoloader file.
Step 1: Installation of Composer
Please refer to the article How to Install Composer.
Step 2: Installation of PHPMailer
Make sure that you have installed Composer and that you are still connected via SSH, as explained before.
- Create the desired folder for PHPMailer:
mkdir mail_app
- Move to the active current working directory (CWD):
cd mail_app
- Install PHPMailer with the Composer command:
composer require phpmailer/phpmailer
- Here is the output of Composer for the installation of php_mailer:
- Here, there is nothing to reload normally. It is in the script that we must indicate the path to PHPMailer:
/home/user/mail_app/vendor/phpmailer/phpmailer
