public static function isValid(MailInterface $mail, $type)
    {
        $validTypes = static::getValidTypes($type);

        return $mail->isEnabled() && \in_array($mail->getType(), $validTypes, true);
    }