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.
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);
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 |
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