PHPMailer permet d’envoyer des Emails depuis une application écrite en langage PHP. Voici comment l’installer sous Linux Debian 9:

Il faut d’abord avoir installé « curl », si ce n’est pas déjà fait:

$ sudo apt update

$ sudo apt install curl

Puis installez composer :

$ sudo curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...
Composer (version 1.10.6) successfully installed to: /var/www/activgest/programs/composer.phar
Use it: php composer.phar
$

Déplacez le programme composer.phar dans le dossier des applications:

$ sudo mv composer.phar /usr/local/bin/composer

$

Rendre le programme composer exécutable:

$ sudo chmod +x /usr/local/bin/composer 

$

Vérifiez que composer fonctionne:

$ composer -V Composer version 1.10.6 2020-05-06 10:28:10 

$

Par la suite, vous pourrez mettre à jour composer par cette commande:

$ sudo composer self-update 
You are already using composer version 1.10.6 (stable channel). 

$

Puis installez PHPMailer à l’aide de composer:

$ composer require phpmailer/phpmailer
Using version ^6.1 for phpmailer/phpmailer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing phpmailer/phpmailer (v6.1.6): Downloading (100%)
phpmailer/phpmailer suggests installing psr/log (For optional PSR-3 debug logging)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Google XOAUTH2 authentication)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for Yahoo XOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed for Microsoft XOAUTH2 authentication)
phpmailer/phpmailer suggests installing symfony/polyfill-mbstring (To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2))
Writing lock file
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
$

A l’arrivée, Composer crée un dossier nommé « vendor« , et tous les packages que vous installerez par Composer iront se ranger dans ce dossier « vendor », parmis lesquels PHPMailer:

$ ls -l vendor
total 40
-rwxrwxr-x 1 fanfan www-data 178 Jul 28 20:03 autoload.php
drwxrwsr-x 2 fanfan www-data 4096 Jul 28 20:03 composer
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 ezyang
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 maennchen
drwxrwsr-x 4 fanfan www-data 4096 Jul 28 20:03 markbaker
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 myclabs
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 phpmailer
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 phpoffice
drwxrwsr-x 6 fanfan www-data 4096 Jul 28 20:03 psr
drwxrwsr-x 3 fanfan www-data 4096 Jul 28 20:03 symfony
$

 

Print Friendly, PDF & Email

Leave a Reply

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Blue Captcha Image
Refresh

*

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.