I'm using the AWS PHP SDK. I have the following code to send an email using SES:
$ses = new AmazonSES(...);
$response = $ses->send_email('ubuntu@localhost',
array('ToAddresses' => '[email protected]'),
array(
'Subject.Data' => 'My Test message',
'Body.Text.Data' => 'my message'
)
);
Simple enough, right? But I get the following error from the AWS SDK itself:
Undefined index: body
sdk.class.php(828)
// Normalize JSON input
828 if ($query['body'] === '[]')
829 {
830 $query['body'] = '';
831 }
My AWS access and secret keys are correct, since I am able to use S3. What am I missing here?
EDIT: I verified a different email address on @gmail.com, and used that as the from address instead. I still ran into the original bug reported. I had no problem using the third party library I mentioned though.
UPDATE: This bug is now patched! Please download the latest version.
This seems to be a confirmed bug in the Amazon SDK. See link below...
https://forums.aws.amazon.com/thread.jspa?messageID=231411
As far as I can tell, there is no patch for this yet. I suppose you could patch it yourself using isset(). That's what I did, and it seems to work now. Again, this is a bug in sdk.class.php on line 828. I don't feel like making a patch file right now. Here's what I did to the code, though...
// Normalize JSON input
if (!isset($query['body']) || $query['body'] === '[]')
{
$query['body'] = '';
}
Again, not an official patch, but it lets you go on your happy way.
I would guess that you need a non-private email address which ubuntu@localhost clearly isn't.
(edit) Also from the documentation you need to verify that you are the owner of said email address, which you clearly cannot do with ubuntu@localhost.
Email Address Verification
Before you can send your first message, Amazon SES requires that you verify your email address. This is to confirm that you own the email address, and to prevent others from using it.
http://docs.amazonwebservices.com/es/latest/DeveloperGuide/index.html?InitialSetup.EmailVerification.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With