https://github.com/badams/symfony-mailer-amazon-sdk
Transport for the mailer component that utilizes aws-sdk-php for authentication
https://github.com/badams/symfony-mailer-amazon-sdk
aws-credentials aws-ses symfony-mailer
Last synced: 5 months ago
JSON representation
Transport for the mailer component that utilizes aws-sdk-php for authentication
- Host: GitHub
- URL: https://github.com/badams/symfony-mailer-amazon-sdk
- Owner: badams
- License: mit
- Created: 2020-01-28T02:32:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-04T17:16:41.000Z (about 5 years ago)
- Last Synced: 2024-04-29T03:45:36.086Z (about 2 years ago)
- Topics: aws-credentials, aws-ses, symfony-mailer
- Language: PHP
- Size: 30.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Symfony Mailer Amazon SDK Transport
================================
[](https://github.com/badams/symfony-mailer-amazon-sdk/workflows/continuous-integration)
[](https://codecov.io/gh/badams/symfony-mailer-amazon-sdk)
[](https://scrutinizer-ci.com/g/badams/symfony-mailer-amazon-sdk/?branch=master)
An SES transport for the [symfony/mailer](https://github.com/symfony/mailer) package which implements support for the official [aws/aws-sdk-php](https://github.com/aws/aws-sdk-php) package.
This differs from the official [symfony/amazon-mailer](https://github.com/symfony/amazon-mailer) as it relies on the official amazon sdk for authentication, meaning support for instance
based authentication on EC2 instances will work out of the box.
Getting Started
--------------
Read the [documentation](https://symfony.com/doc/current/components/mailer.html) for the symfony/mailer package.
The transport should be installed using composer.
```bash
composer require badams/symfony-mailer-amazon-sdk
```
Below is an example of manually configuring the mailer component to use this transport
```php
use Badams\AmazonMailerSdk;
$factory = new Symfony\Component\Mailer\Transport([
new SesSdkTransportFactory()
]);
$transport = $factory->fromString('ses+sdk://ap-south-2?credentials=env');
$mailer = new \Symfony\Component\Mailer\Mailer($transport);
$mailer->send($email);
```
Configuration
------------
This transport supports configuration via DSN, below are example DSNs demonstrating how to configure the supported credential providers.
| Authentication | Example DSN | Docs |
|-----------------------|-------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| Default Provider | ses+sdk://eu-east-1 | [Link](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html#_defaultProvider) |
| Static Credentials | ses+sdk://ACCESS_KEY:SECRET_KEY@eu-west-1 | [Link](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html#_fromCredentials) |
| Environment Variables | ses+sdk://eu-west-1?credentials=env | [Link](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html#_env) |
| Instance Profile | ses+sdk://ap-south-2?credentials=instance | [Link](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html#_instanceProfile) |
| ECS | ses+sdk://us-east-1?credentials=ecs | [Link](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Credentials.CredentialProvider.html#_instanceProfile) |
#### SES Configuration Sets
> Configuration sets are groups of rules that you can apply to the emails you send using Amazon SES. You apply a configuration set to an email by including a reference to the configuration set in the headers of the email. When you apply a configuration set to an email, all of the rules in that configuration set are applied to the email. For more information about specifying configuration sets in your emails, see Specifying a Configuration Set When You Send Email.
- https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-configuration-sets.html
This transport supports Configuration Sets, all you need to do is specify the `ConfigurationSetName` as query string parameter in your DSN like so
```
ses+sdk://eu-west1?ConfigurationSetName=MyConfigurationSet
```