Vortos
AWS SES

SES Configuration

Full configuration reference for the Vortos AWS SES package.

SES Configuration

config/aws_ses.php receives Vortos\AwsSes\DependencyInjection\VortosAwsSesConfig. Every setting has a default, so simple projects can install the package, set environment variables, and start using it.

config/aws_ses.php
<?php

declare(strict_types=1);

use Vortos\AwsSes\Config\AwsSesObservabilitySection;
use Vortos\AwsSes\DependencyInjection\VortosAwsSesConfig;

return static function (VortosAwsSesConfig $config): void {
    $config
        ->driver($_ENV['VORTOS_MAILER_DRIVER'] ?? 'log')
        ->region($_ENV['AWS_SES_REGION'] ?? 'us-east-1')
        ->fallbackRegion($_ENV['AWS_SES_FALLBACK_REGION'] ?? null)
        ->defaultFrom($_ENV['SES_FROM_ADDRESS'] ?? '', $_ENV['SES_FROM_NAME'] ?? '')
        ->replyTo($_ENV['SES_REPLY_TO'] ?? null)
        ->configurationSet($_ENV['SES_CONFIGURATION_SET'] ?? null)
        ->templateDir(__DIR__ . '/../templates/email');

    $config->awsClient()
        ->endpointOverride($_ENV['AWS_ENDPOINT'] ?? null)
        ->httpTimeout(2.0)
        ->maxRetries(3);

    $config->outbox()
        ->enabled(true)
        ->batchSize(50)
        ->sleepSecondsWhenEmpty(2)
        ->maxDeliveryAttempts(5)
        ->retryStrategy('exponential')
        ->backoffBaseSeconds(30)
        ->backoffCapSeconds(3600)
        ->staleMessageTimeoutSeconds(300);

    $config->rateLimit()
        ->maxSendRate(14)
        ->burst(14)
        ->waitTimeoutMs(5000);

    $config->suppression()
        ->syncOnStartup(false)
        ->onSuppressed('throw');

    $config->webhooks()
        ->enabled(true)
        ->routePath('/webhooks/aws/ses');

    $config->auditLog()->enabled(true);

    $config->circuitBreaker()
        ->failureThreshold(5)
        ->resetTimeoutSeconds(60);

    $config->observability()
        ->logging(true)
        ->tracing(true)
        ->metrics(true)
        ->disableLoggingFor(AwsSesObservabilitySection::RateLimit);
};

Top-Level Settings

MethodDefaultPurpose
driver()$_ENV['VORTOS_MAILER_DRIVER'] ?? 'log'ses, log, or null.
region()$_ENV['AWS_SES_REGION'] ?? 'us-east-1'Primary SES region.
fallbackRegion()$_ENV['AWS_SES_FALLBACK_REGION'] ?? nullEnables multi-region failover when set.
defaultFrom()SES_FROM_ADDRESS, SES_FROM_NAMESender used when an Email does not set from.
replyTo()$_ENV['SES_REPLY_TO'] ?? nullDefault Reply-To.
configurationSet()$_ENV['SES_CONFIGURATION_SET'] ?? nullSES configuration set for AWS-level tracking.
templateDir()nullDirectory for PHP email templates.

AWS Client

MethodDefaultPurpose
endpointOverride()$_ENV['AWS_ENDPOINT'] ?? nullCustom SES endpoint. Do not use LocalStack in official CI for this package.
httpTimeout()2.0Provider request timeout in seconds.
maxRetries()3AWS SDK retry attempts.

Outbox

MethodDefaultPurpose
enabled()trueRoutes MailerInterface through transactional outbox.
tableName()aws_ses_outboxOutbox table.
batchSize()50Relay batch size.
sleepSecondsWhenEmpty()2Worker idle sleep.
maxDeliveryAttempts()5Attempts before terminal failure.
retryStrategy()exponentialRetry calculation strategy.
backoffBaseSeconds()30Initial retry delay.
backoffCapSeconds()3600Maximum retry delay.
staleMessageTimeoutSeconds()300Lease timeout for stuck in-progress messages.

Outbox is the default

For business workflows, keep outbox enabled and inject MailerInterface from command handlers. Use ImmediateMailerInterface only when you explicitly want a direct provider call.

Rate Limit

Set maxSendRate() to the SES account's production send rate. This protects you from provider throttling and helps keep worker behavior predictable.

MethodDefault
maxSendRate()14
burst()14
waitTimeoutMs()5000

Suppression

MethodDefaultPurpose
tableName()aws_ses_suppression_listLocal suppression table.
syncOnStartup()falseWhether to sync from SES during boot. Usually leave false and run explicit commands.
onSuppressed()throwthrow rejects the email; strip removes suppressed recipients.

Audit Log

MethodDefault
enabled()true
tableName()aws_ses_audit_log

Webhooks

MethodDefault
enabled()true
routePath()/webhooks/aws/ses

Observability

Observability uses the framework logger, tracing, and metrics packages. The SES package enables all three by default and lets you opt out globally or by typed section.

use Vortos\AwsSes\Config\AwsSesObservabilitySection;

$config->observability()
    ->logging(false)
    ->tracing(false)
    ->metrics(false);

$config->observability()
    ->disableLoggingFor(AwsSesObservabilitySection::Send)
    ->disableTracingFor(AwsSesObservabilitySection::Outbox)
    ->disableMetricsFor(AwsSesObservabilitySection::Webhook);

Sections:

  • AwsSesObservabilitySection::Send
  • AwsSesObservabilitySection::Outbox
  • AwsSesObservabilitySection::Webhook
  • AwsSesObservabilitySection::Suppression
  • AwsSesObservabilitySection::RateLimit
  • AwsSesObservabilitySection::Audit

On this page