badams/symfony-mailer-amazon-sdk

Transport for Symfony Mailer that utilizes the official Amazon SDK

Installs: 7 709

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 0

Open Issues: 2

Type:symfony-bridge

1.0.0 2020-01-28 21:26 UTC

This package is auto-updated.

Last update: 2024-04-05 00:03:37 UTC


README

CI Action codecov Scrutinizer Code Quality

An SES transport for the symfony/mailer package which implements support for the official aws/aws-sdk-php package. This differs from the official 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 for the symfony/mailer package.

The transport should be installed using composer.

 composer require badams/symfony-mailer-amazon-sdk

Below is an example of manually configuring the mailer component to use this transport

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
Static Credentials ses+sdk://ACCESS_KEY:SECRET_KEY@eu-west-1 Link
Environment Variables ses+sdk://eu-west-1?credentials=env Link
Instance Profile ses+sdk://ap-south-2?credentials=instance Link
ECS ses+sdk://us-east-1?credentials=ecs Link

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.

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