- Can I use `symfony/amazon-mailer` directly in Laravel without Symfony Mailer?
- No, this package requires Symfony Mailer as a dependency. For Laravel-only projects, you’ll need to either include Symfony Mailer explicitly or wrap it in a custom transport adapter for Laravel’s Mail facade. The integration is feasible but adds complexity.
- How do I configure AWS SES credentials in Laravel’s `.env` file?
- Use the DSN format in your `.env` file, e.g., `MAIL_MAILER=ses+smtp://ACCESS_KEY:SECRET_KEY@default?region=us-east-1&port=465`. Replace `ACCESS_KEY` and `SECRET_KEY` with your AWS credentials, and adjust the region/port as needed. For API transport, use `ses+api://` instead.
- Does `symfony/amazon-mailer` support SES templates or SNS event notifications?
- The package itself focuses on transport, but you can leverage AWS SES templates and SNS events by using the `ses+api://` transport, which provides direct access to the SES API. For template rendering, ensure your Laravel mailables align with SES’s static HTML/JSON template requirements.
- What Laravel versions and PHP versions are supported?
- This package aligns with Symfony Mailer’s requirements, which mandate PHP 8.4+. For Laravel, it works with Laravel 10+ natively. Older Laravel versions (e.g., 9.x) may require polyfills or adjustments due to Symfony’s stricter PHP versioning.
- How do I enforce STARTTLS for SMTP in the DSN configuration?
- Use `ses+smtp://...?port=587` to enable STARTTLS by default. The transport enforces TLS on ports like 587. To override this, add `require_tls=0` to disable enforcement (not recommended for security) or `require_tls=1` to enforce it even on implicit TLS ports like 465.
- What’s the fallback if AWS SES throttles or fails in production?
- The package doesn’t include built-in fallbacks, but you can configure Laravel’s Mail manager to use a secondary transport (e.g., SMTP) in `config/mail.php`. For example, set `MAIL_MAILER` dynamically based on SES availability or use a queue driver to retry failed emails.
- Can I use this package with Laravel’s Mailable classes?
- Yes, Laravel’s Mailable classes will work seamlessly with `symfony/amazon-mailer` as long as you configure the DSN in `.env` and ensure your mailables use the `Mail::to()->send()` syntax. SES templates require static HTML/JSON, so avoid dynamic PHP in your blade templates.
- What are the differences between `ses+smtp`, `ses+https`, and `ses+api` transports?
- `ses+smtp` uses SMTP with implicit TLS or STARTTLS, ideal for legacy compatibility. `ses+https` communicates via HTTPS directly to SES, offering lower latency but requiring AWS credentials. `ses+api` provides full SES API access, enabling advanced features like templates and event subscriptions.
- How do I handle AWS SES sandbox restrictions in development?
- AWS SES sandbox mode requires verified email addresses and domains. Configure your `.env` with verified credentials, and test with low-volume emails. Use the `ses+api://` transport to verify identities programmatically via the SES API if needed.
- Are there alternatives to `symfony/amazon-mailer` for Laravel?
- For Laravel-native solutions, consider `spatie/laravel-ses` (a dedicated Laravel package for SES) or third-party SMTP transports like `spatie/laravel-mailables` with AWS SES SMTP endpoints. However, `symfony/amazon-mailer` offers deeper SES API integration and transport flexibility.