PHPMailer is Required for SMTP to function.
Today there will be a little story about what to do with a not very fun situation of an outdated site.
We had an old site for Drupal 8.8 that had to be moved to another hosting, which was not very well friends with Google by mail. In order for the letters to come from the site it was necessary to send them through the domain mail and SMTP.
The problem was that the site was done for a long time, other developers, in times when the quality was not very good, and the composer was older. Due to the fact that the core 8.8 version had to use the SMTP Module 8x-1.1 and the composer on the new host simply refused to work with old versions of files and libraries.
At the same time, attempts to make a copy of the site and on the normal vps server all were not successful and caused only new piles of mistakes.
The first found a working site with an installed SMTP, and copied a phpmailer folder from vendor folder to the same on our new host.
Then we need edit file composer.lock and approximately after 7191 we add this code
{
"name": "phpmailer/phpmailer",
"version": "v6.4.0",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "050d430203105c27c30efd1dce7aa421ad882d01"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/050d430203105c27c30efd1dce7aa421ad882d01",
"reference": "050d430203105c27c30efd1dce7aa421ad882d01",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-filter": "*",
"ext-hash": "*",
"php": ">=5.5.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.5.6",
"yoast/phpunit-polyfills": "^0.2.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-only"
],
"authors": [
{
"name": "Marcus Bointon",
"email": "[email protected]"
},
{
"name": "Jim Jagielski",
"email": "[email protected]"
},
{
"name": "Andy Prevost",
"email": "[email protected]"
},
{
"name": "Brent R. Matzelle"
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.4.0"
},
"funding": [
{
"url": "https://github.com/Synchro",
"type": "github"
}
],
"time": "2021-03-31T20:06:42+00:00"
},
After that edit vendor/composer/autoload_psr4.php and add the term in the penultimate period
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
before
);
After that in file vendor/composer/autoload_static.php go to public static $prefixLengthsPsr4 = array ( and search block line
'P' =>
array (
and add in end of this block
'PHPMailer\\PHPMailer\\' => 20,
After, in public static $prefixDirsPsr4 = array ( add code before );
'PHPMailer\\PHPMailer\\' =>
array (
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
),
As a result, we clean the cache, and go to the Page of Setting the Module Module, where the error about the absence of the library should disappear.