- Can I use symfony/amazon-mailer directly in Laravel without Symfony Mailer conflicts?
- No, this package requires Symfony Mailer as a dependency. For Laravel, you’ll need to either wrap Symfony Mailer in a Laravel service or extend Laravel’s TransportManager to support the `ses+` DSN format. This avoids direct conflicts but adds Symfony Mailer as a transitive dependency.
- What Laravel versions support symfony/amazon-mailer, and are there PHP version requirements?
- Laravel 8+ (PHP 8.0+) or Laravel 9+ (PHP 8.1+) are recommended due to Symfony Mailer’s PHP 8.1+ baseline. Symfony Mailer v8+ requires PHP 8.4+, so check your Laravel version’s compatibility with the Symfony Mailer branch you choose (e.g., v7 for PHP 8.0).
- How do I configure AWS SES credentials securely in Laravel’s `.env` for this package?
- Use the DSN format in your `.env`: `MAIL_MAILER_AMAZON=ses+api://ACCESS_KEY:SECRET_KEY@default?region=us-east-1`. For production, avoid hardcoding keys—use Laravel’s `env()` helper or AWS IAM roles (for EC2/Lambda). Rotate keys via AWS IAM and update `.env` or secrets manager.
- Should I use `ses+api`, `ses+smtp`, or `ses+https` for Laravel, and what are the trade-offs?
- Use `ses+api` for low-latency, high-throughput apps (direct AWS API calls). For legacy systems or SMTP relay needs, use `ses+smtp` with port `465` (implicit TLS) or `587` (STARTTLS). `ses+https` is rarely needed—it’s a fallback for HTTPS-only setups. API avoids SMTP quirks but requires AWS SDK permissions.
- How do I handle SES bounces/complaints in Laravel with this package?
- Configure Amazon SNS topics for SES bounce/complaint notifications, then route messages to an SQS queue or Lambda. Use AWS SDK in a Laravel job to process notifications. This requires additional AWS setup (IAM permissions, SNS topic subscriptions) but integrates cleanly with Laravel’s queue system.
- Will this package work with Laravel’s Mail facade out of the box, or do I need custom code?
- No, it won’t work directly with Laravel’s Mail facade. You’ll need to create a wrapper service (e.g., `AmazonMailerService`) that initializes Symfony Mailer with the `ses+` transport, then inject it into Laravel’s mail system. Alternatively, extend Laravel’s `TransportManager` to register the custom DSN.
- How can I test TLS/STARTTLS configurations locally without hitting AWS SES?
- Use Symfony Mailer’s built-in mock transports or configure a local SMTP server (e.g., MailHog). For SES-specific testing, enable the SES Sandbox and use the `verify-email-address` API to validate configurations. Test edge cases like custom headers or attachments in your CI pipeline with a mock transport.
- What are the risks of using `require_tls=0` in the DSN for Laravel production?
- Setting `require_tls=0` disables STARTTLS enforcement, exposing emails to interception if the network isn’t trusted. Only use this if your infrastructure guarantees a secure path (e.g., internal SMTP relay). For production, enforce TLS (`require_tls=1` or implicit TLS on port `465`) to comply with security best practices.
- Are there alternatives to symfony/amazon-mailer for Laravel that avoid Symfony dependencies?
- Yes, consider `aws/aws-sdk-php` with a custom Laravel mail transport or packages like `spatie/laravel-aws-ses` (older, SwiftMailer-based). These avoid Symfony but may lack advanced features like SNS integration. For minimal overhead, a custom transport using the AWS SDK is the most lightweight option.
- How do I handle SES throttling or outages in Laravel with this package?
- Symfony Mailer’s transport layer includes retry logic for throttling, but configure AWS SDK retry settings (e.g., `max_retries`) in your DSN or wrapper. For outages, implement a fallback transport (e.g., SendGrid) by extending Laravel’s `TransportManager` to switch dynamically based on SES availability.