PHPでSESのメール送信を行う

pear を利用する場合は、以下のようにAWS SDKをインストールします。

pear channel-discover pear.amazonwebservices.com
pear install aws/sdk
<?php

require 'AWSSDKforPHP/aws.phar';

use Aws\Ses\SesClient,
    Aws\Ses\Exception\SesException,
    Aws\Common\Enum\Region;

$client = SesClient::factory(array(
    'key'    => '*****************',
    'secret' => '*****************',
    'region' => Region::US_EAST_1,
));

try {
    $client->sendEmail(array(
        'Source' => 'no-reply@sample.com',
        'Destination' => array(
            'ToAddresses' => array('user1@sample.com'),
        ),
        'Message' => array(
            'Subject' => array(
                'Data' => 'Subject',
            ),
            'Body' => array(
                'Text' => array(
                    'Data' => 'This is message.',
                ),
            ),
        ),
    ));
} catch (SesException $e) {
}