daniel-zahariev / php-aws-ses

PHP classes that interfaces Amazon Simple Email Service
307 stars 100 forks source link

Many PHP notices issued when using the lib #5

Closed cyril-bouthors closed 10 years ago

cyril-bouthors commented 10 years ago

Several PHP notices are issued when using the lib:

PHP Notice:  Undefined property: stdClass::$body in /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php on line 173
PHP Stack trace:
PHP   1. {main}() /tmp/php-aws-ses/src/1.php:0
PHP   2. SimpleEmailService->listVerifiedEmailAddresses() /tmp/php-aws-ses/src/1.php:31
PHP   3. SimpleEmailServiceRequest->getResponse() /tmp/php-aws-ses/src/SimpleEmailService.php:108
PHP   4. curl_exec() /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php:128
PHP   5. SimpleEmailServiceRequest->__responseWriteCallback() /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php:128
PHP Notice:  Undefined property: stdClass::$body in /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php on line 173
PHP Stack trace:
PHP   1. {main}() /tmp/php-aws-ses/src/1.php:0
PHP   2. SimpleEmailService->sendEmail() /tmp/php-aws-ses/src/1.php:39
PHP   3. SimpleEmailServiceRequest->getResponse() /tmp/php-aws-ses/src/SimpleEmailService.php:338
PHP   4. curl_exec() /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php:128
PHP   5. SimpleEmailServiceRequest->__responseWriteCallback() /tmp/php-aws-ses/src/SimpleEmailServiceRequest.php:128
PHP Warning:  SimpleEmailService::sendEmail(): Sender - MessageRejected: Email address is not verified.
Request Id: (...)
 in /tmp/php-aws-ses/src/SimpleEmailService.php on line 372
PHP Stack trace:
PHP   1. {main}() /tmp/php-aws-ses/src/1.php:0
PHP   2. SimpleEmailService->sendEmail() /tmp/php-aws-ses/src/1.php:39
PHP   3. SimpleEmailService->__triggerError() /tmp/php-aws-ses/src/SimpleEmailService.php:343
PHP   4. trigger_error() /tmp/php-aws-ses/src/SimpleEmailService.php:372

This can be reproduced with a simple script from the manual:

require('SimpleEmailServiceMessage.php');
require('SimpleEmailService.php');
require('SimpleEmailServiceRequest.php');

$ses = new SimpleEmailService(...);

$ses->listVerifiedEmailAddresses();

$m = new SimpleEmailServiceMessage();
$m->addTo('recipient@example.com');
$m->setFrom('user@example.com');
$m->setSubject('Hello, world!');
$m->setMessageFromString('This is the message body.');

$ses->sendEmail($m);

Can you define variable before using them and avoid notices?

daniel-zahariev commented 10 years ago

Yep, will take a look at it today or tomorrow.

cyril-bouthors commented 10 years ago

Thanks