Created
March 15, 2016 18:41
-
-
Save pokemaobr/6a731f784b2bec6a29e7 to your computer and use it in GitHub Desktop.
Envio de E-mail SES AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'aws-sdk/aws-autoloader.php'; | |
use Aws\Ses\SesClient; | |
$client = SesClient::factory(array( | |
'credentials' => array( | |
'key' => 'SUA_KEY_AQUI', | |
'secret' => 'SUA_SECRET_AQUI', | |
), | |
'region' => 'REGIAO_AWS' | |
)); | |
try { | |
$sendEmail = $client->sendEmail(array( | |
// Source is required | |
'Source' => 'EMAIL_HABILITADO_PARA_ENVIO', | |
// Destination is required | |
'Destination' => array( | |
'ToAddresses' => array('EMAIL_DE_DESTINO_PARA_ENVIO'), | |
), | |
// Message is required | |
'Message' => array( | |
// Subject is required | |
'Subject' => array( | |
// Data is required | |
'Data' => 'SUBJECT', | |
'Charset' => 'UTF-8', | |
), | |
// Body is required | |
'Body' => array( | |
'Text' => array( | |
// Data is required | |
'Data' => 'BODY_PLAINTEXT', | |
'Charset' => 'UTF-8', | |
), | |
'Html' => array( | |
// Data is required | |
'Data' => 'BODY_HTML', | |
'Charset' => 'UTF-8', | |
), | |
), | |
), | |
'ReplyToAddresses' => array('REPLY_TO'), | |
'ReturnPath' => 'RETURN_PATH', | |
)); | |
} | |
catch (Exception $e) { | |
print ($e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment