Search by

adachsoft / notification-channel-email

Arkadiusz Adach

E-mail channel for adachsoft/notification-contracts: resolves recipient addresses and sends plain-text e-mail through a pluggable transport interface (SMTP/provider transports are separate adapters).

Package info

gitlab.com/a.adach/notification-channel-email

Issues

pkg:composer/adachsoft/notification-channel-email

Statistics

Installs: 4

Dependents: 1

Suggesters: 0

Stars: 0

v0.1.0 2026-11-23 13:55 UTC

This package is auto-updated.

Last update: 2026-11-23 12:56:01 UTC


README

adachsoft/notification-channel-email provides an e-mail channel for adachsoft/notification-contracts. It resolves a leaf recipient's address and sends a plain-text message through an application-provided transport. SMTP clients, provider integrations, and user-store lookups are supplied separately.

Features

  • Validated e-mail addresses and message headers.
  • Pluggable recipient address resolver and transport interfaces.
  • Optional reply-to address and notification category/source headers.
  • SENT on successful delivery and SKIPPED when no recipient address is available.
  • In-memory resolver and transport for tests, examples, and simple configurations.

Installation

composer require adachsoft/notification-channel-email

Requirements

  • PHP 8.3 or later.
  • adachsoft/notification-contracts:^0.1.
  • adachsoft/reference-contracts:^0.1.
  • psr/clock:^1.0.

Usage

Provide implementations of EmailAddressResolverInterface and EmailTransportInterface, then construct the channel with those services, a sender address, and a PSR-20 clock:

$channel = new EmailNotificationChannel(
    addresses: $addressResolver,
    transport: $emailTransport,
    from: new EmailAddress('notifications@example.com'),
    clock: $clock,
);

$result = $channel->send($notification, $recipient);

The resolver receives a leaf PrincipalReference; expand groups in the dispatcher or an application-level principal resolver. Address-resolution and transport errors are wrapped in NotificationDeliveryException.

See the direct-channel usage example for a complete example using the in-memory adapters. InMemoryEmailTransport records messages and does not send e-mail.