jplarar / ses-bundle
一个简单的用于 AWS SES API 的 Symfony2 扩展包。
1.2.0
2019-06-11 20:37 UTC
Requires
- php: >=5.3
- aws/aws-sdk-php: ^3.0
- sensio/framework-extra-bundle: >=2.1
- symfony/config: >=2.1
- symfony/dependency-injection: >=2.1
- symfony/filesystem: >=2.1
- symfony/framework-bundle: >=2.1
- symfony/http-foundation: >=2.1
- symfony/http-kernel: >=2.1
- symfony/options-resolver: >=2.1
- symfony/security: >=2.1
- symfony/validator: >=2.1
This package is auto-updated.
Last update: 2024-09-12 09:31:37 UTC
README
一个简单的用于 AWS SES API 的 Symfony2 扩展包。
设置
步骤 1: 使用 composer 下载 JplararSESBundle
在 composer.json 中添加 SES 扩展包
{ "require": { "jplarar/ses-bundle": "^1.0.0" } }
现在运行以下命令让 composer 下载扩展包:
$ php composer.phar update "jplarar/ses-bundle"
步骤 2: 启用扩展包
在内核中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Jplarar\SESBundle\JplararSESBundle() ); }
步骤 3: 添加配置
# app/config/config.yml jplarar_ses: amazon_ses: amazon_ses_key: %amazon_ses_key% amazon_ses_secret: %amazon_ses_secret% amazon_ses_region: %amazon_ses_region%
用法
使用服务
<?php $sesClient = $this->get('amazon_ses_client'); ?>
##示例
###向 SES 发送新邮件
<?php $result = $sesClient->sendEmail( 'recipient@example.com', 'subject', 'sender@example.com', '<h1>AWS Amazon Simple Email Service Test Email</h1>', 'This email was send with Amazon SES using the AWS SDK for Symfony.' ); $messageId = $result->get('MessageId'); echo("Email sent! Message ID: $messageId"."\n"); ?>