HOW TO UPGRADE PHPMailer FROM 5.2 TO 6.02 USING COMPOSER.

Thursday, July 12, 2018 0 Comments A+ a-


Step 1:
/data/PHPList/PHPList_Dev_Sarendar/public_html/lists/admin/PHPMailer/composer.json
Modified below code in composer.json

    "require": {

        "php": ">=5.0.0",
"phpmailer/phpmailer": "v6.0.0",
"minimum-stability": "dev"

    },

Step 2:
root$composer update
root$composer require phpmailer/phpmailer

Step 3:


->Here generated vendor folder automatically in project root path.

->Copy entair vendor directory and past it in /data/PHPList/PHPList_Dev_Sarendar/public_html/lists/admin path.
-> And copy /data/PHPList/PHPList_Dev_Sarendar/public_html/lists/admin/vendor/phpmailer entair directory and past it in /data/PHPList/PHPList_Dev_Sarendar/public_html/lists/admin/PHPMailer file path.

Step4:

And modify the below code in below files.
File 1: /data/PHPList/PHPList_Dev_Sarendar/public_html/lists/config/config.php
Add autoload file in config file.
Added: include($_SERVER['DOCUMENT_ROOT']."/admin/vendor/autoload.php");
File 2: /data/PHPList/PHPList_Dev_Sarendar/public_html/lists/admin/class.phplistmailer.php
->Add name spaces in at top of the above file.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

-> And comment below code, this is 5.xx version file loading.

require_once dirname(__FILE__).'/PHPMailer/PHPMailerAutoload.php';

->And comment below public veriable in PHPlistMailer class

public $LE = "\n";

Step5:

->Try to send mail from phplist.
->Right click on recived mail and click on Show Original
->Search with 'PHPMailer'
->And result should be
X-Mailer: PHPMailer 6.0.5 (https://github.com/PHPMailer/PHPMailer)

REFERENCE: https://github.com/PHPMailer/PHPMailer/blob/master/UPGRADING.md

Blogger, Software Techie, Programmer