Under the trial conditions, the supplementation of 120 mg/day of melatonin for dairy cows can improve their milk composition (milk fat rate, milk protein rate, milk fat rate, lactose yield, and milk protein yield), antioxidant capacity (improved SOD and GSH-Px activity), and immune capacity (increased IL-10 content and reduced TNF-α and IL-6 content); reduce the somatic cell count; and have a certain effect on the prevention and treatment of mastitis. This evidence concerns the gene TNF and mastitis.