MailGate
Corex\Mail\Capture\MailGate · class · Core layer
Decides, for every email, whether it is sent, captured, held for a test or refused (spec 113, research R3). CoreX’s mail service asks it before its driver, and the pre_wp_mail filter asks it for everything else that calls wp_mail(). Production, Coming soon and Maintenance answer “deliver” before anything else is read: the owner decided that this release changes development and staging only (SAFE-D2). The capture store and the activity log belong to CoreX Mail and corex-config, which may be inactive, so both are looked up when they are needed and only if they are there.
Public API
Section titled “Public API”__construct(SiteEnvironment $environment, ConfigInterface $config, MailHold $hold, ContainerInterface $container)
Section titled “__construct(SiteEnvironment $environment, ConfigInterface $config, MailHold $hold, ContainerInterface $container)”decide(bool $corexMail): MailDecision
Section titled “decide(bool $corexMail): MailDecision”scope(): string
Section titled “scope(): string”Whether all mail is captured on a development or staging site, or only CoreX’s.
keep(CapturedMessage $message, MailDecision $decision): ?string
Section titled “keep(CapturedMessage $message, MailDecision $decision): ?string”Keep a message the decision said to keep, as captured or as held for a test. Returns the capture’s id, or null when it could not be kept (it is then recorded as refused).
refuse(CapturedMessage $message): void
Section titled “refuse(CapturedMessage $message): void”Record an email that was neither sent nor kept, so that nothing is lost unseen (FR-009).