4

I'm new in Amazon SES and I'm trying to send an email with this code:

<?php require_once 'aws/sdk.class.php'; $ses = new AmazonSES(); $to = array('ToAddress' => '[email protected]'); $content = array('Subject.Data' => 'Tema', 'Body.Text.Data' => 'hello'); $r = $ses->send_email("[email protected]", $to , $content); print_r($r); ?> 

In the output it says: Missing required header 'To', what am I doing wrong?

7
  • Is that your entire code? If it isn't, then without your entire code, no one can properly help you with the problem in question. Commented Jun 15, 2012 at 17:46
  • Yes, I only truncated the import statement of the Amazon SDK. Commented Jun 15, 2012 at 17:50
  • If you can't supply your full PHP code, then check if $headers .= 'To: and mail($mail_to... etc.) exist. Commented Jun 15, 2012 at 17:52
  • Without your full code, I/we can't make any guesses to potentially solve your problem. Commented Jun 15, 2012 at 17:55
  • @Fred I'm not trying to send an email by hand, I'm using the Amazon Simple Email Service. Commented Jun 15, 2012 at 17:56

1 Answer 1

7

I already solved it, I had two problems in my code:

  1. The index "ToAddress" is incorrect, it has to be in plural "ToAddresses".
  2. And the value it has to be an array like this: array('[email protected]')
Sign up to request clarification or add additional context in comments.

1 Comment

Amazingly, I also had the exact same error "ToAddress" instead of "ToAddresses". Therefore everyone should check that your array keys are correct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.