You are here

private function AmazonSesClass::sendEmail in Amazon SES 7

Call Query API action SendEmail.

Composes an email message based on input data, and then immediately queues the message for sending.

1 call to AmazonSesClass::sendEmail()
AmazonSesClass::performServiceAction in includes/classes/amazonses.class.php
Add required parameter & header to the Query according to Query action.

File

includes/classes/amazonses.class.php, line 280
Class for interacting with Amazon SES service.

Class

AmazonSesClass
Modify the drupal mail system to use Amazon SES.

Code

private function sendEmail($action_parameter) {
  $mail = $action_parameter['mail'];
  $message = $mail['message'];
  $opt = $action_parameter['opt'];
  $response_xml = $this->sesClient
    ->send_email($mail['from'], $mail['destination'], $message, $opt);
  $response = $response_xml->body
    ->to_stdClass();
  if ($response_xml->status == '200') {
    $result['status'] = AMAZON_SES_REQUEST_SUCCESS;

    // todo: Will be used later.
    if (isset($response->SendEmailResult->MessageId)) {
      $result['message_id'] = check_plain($response->SendEmailResult->MessageId);
    }
  }
  else {
    $result['status'] = AMAZON_SES_REQUEST_FALIURE;
  }
  return $result;
}