Immunity against extracellular pathogens