phil / email-address-bundle
Catches mistyped, disposable and undeliverable email addresses in forms, and turns bounces and complaints into suspend, unsubscribe or review decisions.
Package info
github.com/parler-haut-interagir-librement/email-address-bundle
Type:symfony-bundle
pkg:composer/phil/email-address-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- phil/bounce-parser: ^0.1@dev
- phil/email-address: ^0.1@dev
- psr/cache: ^3.0
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
- symfony/cache-contracts: ^3.6
- symfony/clock: ^8.2
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/http-foundation: ^8.2
- symfony/service-contracts: ^3.6
- symfony/validator: ^8.2
Requires (Dev)
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- symfony/browser-kit: ^8.2
- symfony/cache: ^8.2
- symfony/console: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/form: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-kernel: ^8.2
- symfony/messenger: ^8.2
- symfony/options-resolver: ^8.2
- symfony/remote-event: ^8.2
- symfony/routing: ^8.2
- symfony/translation: ^8.2
- symfony/translation-contracts: ^3.6
Suggests
- symfony/console: For the commands that read a raw bounce and the bounce mailbox
- symfony/form: For the email field with its typo suggestion and role warning
- symfony/messenger: To send each bounce decision on to a worker, without the address
- symfony/remote-event: To consume the bounce and complaint events of a mail provider's webhook
- symfony/routing: For the route that serves the known domains to the Stimulus controller
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-26 01:19:20 UTC
README
Accepts email addresses by a policy per site and per list, suggests the address meant in the browser, and turns bounces and complaints into decisions, in Symfony.
phil/email-address-bundle integrates phil/email-address and phil/bounce-parser with Symfony. The libraries alone
suit an application without Symfony.
- The constraint on the container. The library's
DeliverableEmailAddressgets the container's lists and resolver;AcceptedEmailAddressapplies the policy of the bundle, of the current site and of a list, laid over each other: mail server looked up or not, disposable domains, denied domains, the only domains accepted. - The email field.
EmailAddressTypesuggests the address meant when its domain is a slip of a known one —ada@gmial.com— and warns about a role address such asinfo@, without refusing either: in the browser through a Stimulus controller and a live region, and without JavaScript as the field's help once the form is submitted. - The normalized form.
EmailAddressescompares two addresses, keys them by a fingerprint that does not give the address back, and tells a role address; it keeps the dots and the+tagof the person's address. - The bounce rules. A hard bounce suspends the address; soft bounces count up to a threshold within a window; an authenticated complaint unsubscribes, and one no authenticator vouches for goes to review. Each decision is a Symfony event, and can go on to Messenger with identifiers only.
- Three inputs. The mailer events of a provider's webhook, through Symfony's Webhook and RemoteEvent components;
a raw message piped by the mail server to a console command; the bounce mailbox, through the
BounceMailboxport.
Status
| Part | State |
|---|---|
PhilEmailAddressBundle and its configuration phil_email_address |
Implemented and tested |
DeliverableEmailAddress on the container, AcceptedEmailAddress and the policies per site and per list |
Implemented and tested |
EmailAddressType, the route phil_email_address_domains and the Stimulus controller |
Implemented and tested |
EmailAddresses: normalized form, fingerprint, role addresses |
Implemented and tested |
BounceRules, the event BounceDecided and BounceDecidedMessage |
Implemented and tested |
The webhook consumer and the command phil:email-address:read-bounce |
Implemented and tested |
The port BounceMailbox, its Maildir adapter and the command phil:email-address:poll-mailbox |
Implemented and tested |
| Reading an IMAP mailbox | Not in this bundle: fetchmail, getmail or the mail server's local delivery fills the Maildir; BounceMailbox leaves room for a separate IMAP package |
The Flex recipe, in recipe/0.1 |
Prepared |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, the routes and the Stimulus controller. |
| Configuration | Every option, with an example: policies, DNS, suggestions, bounces. |
| Bounces | The bounce rules, their three inputs, the event and the message. |
| Extension points | The services to replace, the events to listen to, and when they are stable. |
| Testing | The bundle's tests, PHP and JavaScript. |
| Reference | Every class and service of the bundle. |
Quick start
// config/bundles.php Phil\EmailAddressBundle\PhilEmailAddressBundle::class => ['all' => true],
# config/packages/phil_email_address.yaml phil_email_address: lists: staff: { allowed_domains: [example.org] } suggestions: url: /email-address/domains.json
use Phil\EmailAddressBundle\Infrastructure\Form\EmailAddressType; $builder->add('email', EmailAddressType::class, ['list' => 'staff']);
use Phil\EmailAddressBundle\Domain\BounceDecision; use Phil\EmailAddressBundle\Domain\Event\BounceDecided; use Symfony\Component\EventDispatcher\Attribute\AsEventListener; #[AsEventListener] final readonly class SuspendBouncedAddresses { public function __invoke(BounceDecided $event): void { if (BounceDecision::Suspend === $event->decision) { // Stop sending to $event->notice->address, or to the recipient $event->notice->recipientId. } } }
Requirements
PHP 8.5 or later and Symfony 8.2 or later. The form field needs symfony/form, the commands symfony/console, the
webhook consumer symfony/remote-event, the forwarding of decisions symfony/messenger, and the route
symfony/routing; the bundle registers each part only when its package is installed.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.