Skip to content

Mail Log: Extension and action examples

Use the action functions with records and Data objects supplied by your application. They pass each argument to the package operation and return its result.

These adapters show container registration. Use the owning package registry when a contract requires contributor discovery.

Contract adapters wrap an existing implementation. Call their registration function from your service provider with that implementation; tagged contracts keep their declared tag. Resolve the backend by its concrete class before registration so the replacement contract does not resolve itself. Static contract metadata uses one backend class per adapter.

Contract Capell\MailLog\Contracts\RecipientSuppressionList

Section titled “Contract Capell\MailLog\Contracts\RecipientSuppressionList”
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
final class RecipientSuppressionListAdapter implements \Capell\MailLog\Contracts\RecipientSuppressionList
{
public function __construct(private readonly \Capell\MailLog\Contracts\RecipientSuppressionList $backend) {}
#[\Override]
public function isSuppressed(string $address, bool $includeComplaints = true): bool
{
return $this->backend->isSuppressed($address, $includeComplaints);
}
}
function registerRecipientSuppressionListAdapter(\Capell\MailLog\Contracts\RecipientSuppressionList $backend): void
{
app()->bind(RecipientSuppressionListAdapter::class, static fn (): RecipientSuppressionListAdapter => new RecipientSuppressionListAdapter($backend));
app()->bind(\Capell\MailLog\Contracts\RecipientSuppressionList::class, RecipientSuppressionListAdapter::class);
app()->tag([RecipientSuppressionListAdapter::class], \Capell\MailLog\Contracts\RecipientSuppressionList::TAG);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runAlertAdminsOfHeldOutboundMessages(\Capell\MailLog\Models\OutboundMessageBreaker $breaker, \Capell\Core\Data\Messaging\OutboundMessageSourceData $source): int
{
return \Capell\MailLog\Actions\AlertAdminsOfHeldOutboundMessagesAction::run($breaker, $source);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runApplyMailProviderEvent(\Capell\MailLog\Data\MailProviderEventData $event): ?\Capell\MailLog\Models\MailLogEntry
{
return \Capell\MailLog\Actions\ApplyMailProviderEventAction::run($event);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runApplyPostmarkMailEvent(\Capell\MailLog\Data\PostmarkMailEventData $event): ?\Capell\MailLog\Models\MailLogEntry
{
return \Capell\MailLog\Actions\ApplyPostmarkMailEventAction::run($event);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runBuildMailHealthDigest(\Carbon\CarbonImmutable $date, int $limit = 5): \Capell\MailLog\Data\MailHealthDigestData
{
return \Capell\MailLog\Actions\BuildMailHealthDigestAction::run($date, $limit);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runBuildMailLogPrivacyExport(\Capell\Core\Data\Privacy\PrivacySubject $subject): array
{
return \Capell\MailLog\Actions\BuildMailLogPrivacyExportAction::run($subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runBuildOutboundMessageHealth(\Carbon\CarbonImmutable $from, \Carbon\CarbonImmutable $to): array
{
return \Capell\MailLog\Actions\BuildOutboundMessageHealthAction::run($from, $to);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runCaptureOutboundMessage(\Capell\Core\Data\Messaging\OutboundMessageSourceData $source, ?\Closure $payload = null): bool
{
return \Capell\MailLog\Actions\CaptureOutboundMessageAction::run($source, $payload);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runDiscardHeldOutboundMessages(iterable $ids, ?\Illuminate\Contracts\Auth\Authenticatable $user = null, bool $includeSending = false): int
{
return \Capell\MailLog\Actions\DiscardHeldOutboundMessagesAction::run($ids, $user, $includeSending);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runEraseMailLogPrivacyData(\Capell\Core\Data\Privacy\PrivacySubject $subject): int
{
return \Capell\MailLog\Actions\EraseMailLogPrivacyDataAction::run($subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runEvaluateOutboundMessageHealth(?\Carbon\CarbonImmutable $now = null): array
{
return \Capell\MailLog\Actions\EvaluateOutboundMessageHealthAction::run($now);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runMarkMailSent(\Illuminate\Mail\SentMessage $sent, ?string $mailer = null): ?\Capell\MailLog\Models\MailLogEntry
{
return \Capell\MailLog\Actions\MarkMailSentAction::run($sent, $mailer);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runMarkOutboundMessageSourceReviewed(\Capell\MailLog\Models\OutboundMessageSource $source, ?\Illuminate\Contracts\Auth\Authenticatable $reviewer = null): \Capell\MailLog\Models\OutboundMessageSource
{
return \Capell\MailLog\Actions\MarkOutboundMessageSourceReviewedAction::run($source, $reviewer);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runMarkUnconfirmedMailFailed(?\Throwable $throwable = null): int
{
return \Capell\MailLog\Actions\MarkUnconfirmedMailFailedAction::run($throwable);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runNotifyAdminsOfNewOutboundMessage(\Capell\MailLog\Models\OutboundMessageSource $source): int
{
return \Capell\MailLog\Actions\NotifyAdminsOfNewOutboundMessageAction::run($source);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runNotifyAdminsOfSourceHealth(\Capell\MailLog\Models\OutboundMessageSource $source, array $incidents, bool $recovered): int
{
return \Capell\MailLog\Actions\NotifyAdminsOfSourceHealthAction::run($source, $incidents, $recovered);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runPurgeMailLog(): \Capell\MailLog\Data\MailLogPurgeResultData
{
return \Capell\MailLog\Actions\PurgeMailLogAction::run();
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runRecordOutgoingMail(\Symfony\Component\Mime\Email $message, array $data, ?\Capell\Core\Data\Messaging\OutboundMessageSourceData $source = null): ?\Capell\MailLog\Models\MailLogEntry
{
return \Capell\MailLog\Actions\RecordOutgoingMailAction::run($message, $data, $source);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runReleaseHeldOutboundMessages(iterable $ids, ?\Illuminate\Contracts\Auth\Authenticatable $user = null): int
{
return \Capell\MailLog\Actions\ReleaseHeldOutboundMessagesAction::run($ids, $user);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runRenderMailHealthDigestSection(\Carbon\CarbonImmutable $date, int $limit = 5): string
{
return \Capell\MailLog\Actions\RenderMailHealthDigestSectionAction::run($date, $limit);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runResolveMailLogSettings(): \Capell\MailLog\Data\MailLogSettingsData
{
return \Capell\MailLog\Actions\ResolveMailLogSettingsAction::run();
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runResolveMailLogSubjectHashes(\Capell\Core\Data\Privacy\PrivacySubject $subject): array
{
return \Capell\MailLog\Actions\ResolveMailLogSubjectHashesAction::run($subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runResolveOutboundMessageSource(array $mailData): \Capell\Core\Data\Messaging\OutboundMessageSourceData
{
return \Capell\MailLog\Actions\ResolveOutboundMessageSourceAction::run($mailData);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runSetOutboundMessageBreaker(string $scope, bool $tripped, ?\Illuminate\Contracts\Auth\Authenticatable $user = null): void
{
\Capell\MailLog\Actions\SetOutboundMessageBreakerAction::run($scope, $tripped, $user);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runSetOutboundMessageSourceEngagement(\Capell\MailLog\Models\OutboundMessageSource $source, bool $enabled): \Capell\MailLog\Models\OutboundMessageSource
{
return \Capell\MailLog\Actions\SetOutboundMessageSourceEngagementAction::run($source, $enabled);
}

Action setOutboundMessageSourceHealthThresholds

Section titled “Action setOutboundMessageSourceHealthThresholds”
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runSetOutboundMessageSourceHealthThresholds(\Capell\MailLog\Models\OutboundMessageSource $source, array $limits): \Capell\MailLog\Models\OutboundMessageSource
{
return \Capell\MailLog\Actions\SetOutboundMessageSourceHealthThresholdsAction::run($source, $limits);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runSuppressMailRecipients(\Capell\MailLog\Models\MailLogEntry $entry, \Capell\MailLog\Data\MailProviderEventData $event, \Capell\MailLog\Enums\MailSuppressionReason $reason): int
{
return \Capell\MailLog\Actions\SuppressMailRecipientsAction::run($entry, $event, $reason);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runSyncOutboundMessageCatalogue(): int
{
return \Capell\MailLog\Actions\SyncOutboundMessageCatalogueAction::run();
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\MailLog;
function runUpdateOutboundMessageBaselines(?\Carbon\CarbonImmutable $at = null): int
{
return \Capell\MailLog\Actions\UpdateOutboundMessageBaselinesAction::run($at);
}