humanmade / aws-ses-wp-mail

An AWS SES wp_mail() drop-in
186 stars 51 forks source link

Class 'Aws\Ses\SesClient' not found #43

Open alikuru opened 5 years ago

alikuru commented 5 years ago

Updated wp-config.php and ran composer install; getting this error while testing with wp-cli:

PHP Fatal error:  Uncaught Error: Class 'Aws\Ses\SesClient' not found in /var/www/domain.tld/http/wp-content/plugins/aws-ses-wp-mail/inc/class-ses.php:230

Any ideas what am I doing wrong?

henrywright commented 5 years ago

I just tried and I get exactly the same error as you did.

git clone https://github.com/humanmade/aws-ses-wp-mail.git aws-ses-wp-mail
cd aws-ses-wp-mail
composer install

The plugin is active and the constants are set in wp-config.php

alikuru commented 5 years ago

OK, added this line on the top for composer auto-loading and now I am able to send with wp-cli:

require_once dirname( __FILE__ ) . '/vendor/autoload.php';
henrywright commented 5 years ago

In a previous version the AWS autoloader was required in SES::get_client(). This was removed when the SDK was removed

roborourke commented 3 years ago

This was intentionally removed in https://github.com/humanmade/aws-ses-wp-mail/pull/41 as it wasn't easy to keep it up to date.

The ideal approach is to install plugins like this via composer, rather than installing composer dependencies per plugin e.g.:

composer require humanmade/aws-ses-wp-mail

Then you could include your project's root level vendor/autoload.php in wp-config.php for example. This means if you have multiple plugins making use of the AWS SDK (such as S3 Uploads) it only needs one shared copy of the SDK in your codebase.