Milk inside the cow is “sterile” (relative to the cow). Milk that has left the cow has now been exposed to airborne bacteria, which leads to spoilage if not properly treated and stored. While pasteurization kills bacteria, it doesn’t necessarily kill **all** bacteria, so it just extends the shelf life instead of making it not spoil.
That being said, cows typically use their milk to feed their calves (or have it stolen by us), so there wouldn’t normally be milk held there indefinitely.
Latest Answers