A composition to prevent mastitis in cows by forming a physical barrier in the teat canal of the cow during the cow's dry period. The composition simultaneously prevents black spot defect in dairy products made with milk from the cow. The composition includes a bismuth-free, non-toxic metal salt or metal oxide disposed in a gel base. The composition has a density sufficient to settle the composition into the teat canal of a cow and thereby forms a physical barrier to entry of microorganisms into the teat canal. Because the composition is devoid of bismuth, the teat seal formulation does not cause black spot defect in dairy products made with milk from the cow.