protected function matchesMail($mail = [], $matches = [])
    {
        // Discard criteria that are just zero-length strings.
        $matches = array_filter($matches, 'strlen');
        // For each criteria, check the specified mail field contains the value.
        foreach ($matches as $field => $value) {
            // Case insensitive.
            if (stripos($mail[$field], $value) === false) {
                return false;
            }
        }
        return true;
    }