TenantMailConfigurator
in package
Applies a tenant's tenant_config.email overrides to the default mail profile and transport for the duration of a tenant-bound scope.
Mode "default" (or no email config) leaves the platform transport untouched. A tenant-level from_address becomes the profile default but an explicit setFrom() by a mailer still wins.
Table of Contents
Constants
- MAILER_PROFILE : mixed = 'default'
- TRANSPORT_NAME : mixed = 'default'
Properties
Methods
- __construct() : mixed
- Constructor.
- apply() : callable(): void
- Apply tenant email overrides and return a restore callback.
- apiConfig() : array<string, mixed>
- azureConfig() : array<string, mixed>
- fromOverride() : array<string, string>|string|null
- Build the profile-level from override, or null when unset.
- resolveSecret() : string|null
- Resolve a stored secret reference to its value.
- smtpConfig() : array<string, mixed>
- transportConfig() : array<string, mixed>|null
- Build the tenant transport configuration, or null to keep the platform default.
- unknownMode() : array<string|int, mixed>|null
- Unknown stored mode: keep the platform default rather than break mail.
Constants
MAILER_PROFILE
private
mixed
MAILER_PROFILE
= 'default'
TRANSPORT_NAME
private
mixed
TRANSPORT_NAME
= 'default'
Properties
$secretStore read-only
private
SecretStoreInterface
$secretStore
Methods
__construct()
Constructor.
public
__construct(SecretStoreInterface $secretStore) : mixed
Parameters
- $secretStore : SecretStoreInterface
-
Secret store for credential references
apply()
Apply tenant email overrides and return a restore callback.
public
apply(TenantMetadata $tenant) : callable(): void
Parameters
- $tenant : TenantMetadata
-
Tenant metadata
Return values
callable(): void —Restores the previous mail configuration
apiConfig()
private
apiConfig(TenantMetadata $tenant, array<string, mixed> $email, string $mode) : array<string, mixed>
Parameters
- $tenant : TenantMetadata
- $email : array<string, mixed>
-
tenant_config.email section
- $mode : string
Return values
array<string, mixed>azureConfig()
private
azureConfig(TenantMetadata $tenant, array<string, mixed> $email) : array<string, mixed>
Parameters
- $tenant : TenantMetadata
- $email : array<string, mixed>
-
tenant_config.email section
Return values
array<string, mixed>fromOverride()
Build the profile-level from override, or null when unset.
private
fromOverride(array<string, mixed> $email) : array<string, string>|string|null
Parameters
- $email : array<string, mixed>
-
tenant_config.email section
Return values
array<string, string>|string|nullresolveSecret()
Resolve a stored secret reference to its value.
private
resolveSecret(TenantMetadata $tenant, string $reference) : string|null
Supports the reference forms accepted by TenantConfigSchema: portable dotted names via the configured secret store, env://VAR for literal environment variables, and secret:// or db:// prefixes stripped down to store lookups. Unresolvable references log a warning and return null so the failure surfaces at send time instead of breaking tenant binding.
Parameters
- $tenant : TenantMetadata
-
Tenant metadata (for log context)
- $reference : string
-
Secret reference name
Return values
string|nullsmtpConfig()
private
smtpConfig(TenantMetadata $tenant, array<string, mixed> $email) : array<string, mixed>
Parameters
- $tenant : TenantMetadata
- $email : array<string, mixed>
-
tenant_config.email section
Return values
array<string, mixed>transportConfig()
Build the tenant transport configuration, or null to keep the platform default.
private
transportConfig(TenantMetadata $tenant, array<string, mixed> $email) : array<string, mixed>|null
Parameters
- $tenant : TenantMetadata
-
Tenant metadata
- $email : array<string, mixed>
-
tenant_config.email section
Return values
array<string, mixed>|nullunknownMode()
Unknown stored mode: keep the platform default rather than break mail.
private
unknownMode(TenantMetadata $tenant, string $mode) : array<string|int, mixed>|null
Parameters
- $tenant : TenantMetadata
- $mode : string