named(Settings::get(MailPurpose::settingKey($purpose))); if ($box !== null) { return $box; } // Fall back rather than fail: a mail that goes out from the wrong // address is recoverable, one that is never sent may not be noticed. return $purpose === MailPurpose::SYSTEM ? null : $this->named(Settings::get(MailPurpose::settingKey(MailPurpose::SYSTEM))); } private function named(mixed $key): ?Mailbox { return is_string($key) && $key !== '' ? Mailbox::findByKey($key) : null; } }