php mailer 5.2.23 Installation via composer
phpMailer is a library package; it would typically be used as part of a larger application. In that case, it should be your main application that uses Composer to install phpMailer and its dependencies. You wouldn't typically want to upload phpMailer manually into your app and then use Composer just for that, which is what it sounds like you're doing.
So this is what you should do.
- Remove the copy of phpMailer that you have already installed.
Go to the root folder of your project, and issue the following commands:
composer require phpmailer/phpmailer composer require league/oauth2-google
(you already did the second one, so it may not be needed, but you didn't say what folder you were in when you did it)
If you weren't already using Composer for your project, make sure that your code always includes the Composer autoload file. So somewhere at the beginning of every page load, you should call
require_once 'vendor/autoload.php';
.
Gary
Updated on May 11, 2020Comments
-
Gary almost 4 years
What I did 1st was
installed composer on my linux system
su to directory user
created a directory in public_html PHPMailer-5_2_23
changed to that directory
uploaded php mailer into that directory
then ran composer update on the supplied composer.json from phpmailer on github here: https://github.com/PHPMailer/PHPMailer
{ "name": "phpmailer/phpmailer", "type": "library", "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "authors": [ { "name": "Marcus Bointon", "email": "[email protected]" }, { "name": "Jim Jagielski", "email": "[email protected]" }, { "name": "Andy Prevost", "email": "[email protected]" }, { "name": "Brent R. Matzelle" } ], "require": { "php": ">=5.0.0" }, "require-dev": { "doctrine/annotations": "1.2.*", "jms/serializer": "0.16.*", "phpdocumentor/phpdocumentor": "2.*", "phpunit/phpunit": "4.8.*", "symfony/debug": "2.8.*", "symfony/filesystem": "2.8.*", "symfony/translation": "2.8.*", "symfony/yaml": "2.8.*", "zendframework/zend-cache": "2.5.1", "zendframework/zend-config": "2.5.1", "zendframework/zend-eventmanager": "2.5.1", "zendframework/zend-filter": "2.5.1", "zendframework/zend-i18n": "2.5.1", "zendframework/zend-json": "2.5.1", "zendframework/zend-math": "2.5.1", "zendframework/zend-serializer": "2.5.*", "zendframework/zend-servicemanager": "2.5.*", "zendframework/zend-stdlib": "2.5.1" }, "suggest": { "league/oauth2-google": "Needed for Google XOAUTH2 authentication" }, "autoload": { "classmap": [ "class.phpmailer.php", "class.phpmaileroauth.php", "class.phpmaileroauthgoogle.php", "class.smtp.php", "class.pop3.php", "extras/EasyPeasyICS.php", "extras/ntlm_sasl_client.php" ] }, "license": "LGPL-2.1" }
after that was done I ran composer command "require league/oauth2-google" as stated here: https://packagist.org/packages/league/oauth2-google
I added the user settings to get get_oauth_token.php to display a token on my brower but i get PHP Fatal error:
Class 'League\OAuth2\Client\Provider\Google' not found in {my directories }
SO I am assuming something is not seeing the Class but i cannot find hardly any info on it Any suggestions or direction?
-
Synchro about 7 yearsExactly right, couldn't have said it better myself!
-
Gary about 7 yearsOk i wiped everything out and started over in a directory call it phmailer directory I had to move the samples provided into that directory because it placed then in phmailer/vendor/phpmailer/phpmailer when i moved the samples to the phmailer directory they started doing there thing. I have another issue but i will make another question THANKYOU
-
kronus about 5 years@simba, I did composer require phpmailer/phpmailer, followed by using require_once "../vendor/autoload.php"; then PHP complains about the next line $mail = new PHPMailer; - Fatal error: Class 'PHPMailer' not found - I have created another directory called PHPMailer in the same directory as vendor, this new directory contain the contents of phpmailer/phpmailer/src, but it still cannot find the PHPMailer class. Do I have to require the PHPMailer.php file as well. I thought that was what the autoload was for?