Maternal milk, a main source of nutrition for neonates in early life, has attracted attention. An increasing number of studies have found that maternal milk has a high microbial diversity, as well as factors that might influence this diversity. However, there is a lack of knowledge regarding the effects of host diet and phylogeny on maternal milk microbes and the contribution of the maternal milk microbiota to the neonatal gut microbiota. Here, we analyzed the maternal milk and fecal microbiota of nine species (lion, dog, panda, human, mouse, rhesus macaque, cow, goat, and rabbit) of mammals of three type groups (herbivore, omnivore, and carnivore) using 16S rRNA amplicon sequencing. Our study provided evidence of host diet and phylogeny on the maternal milk microbiota. Moreover, functional prediction revealed that the carnivores had a significantly higher percentage of base excision repair, glycerolipid metabolism, taurine and hypotaurine metabolism, inorganic ion transport and metabolism, and nucleotide metabolism; while arginine and proline metabolism showed enrichment in the herbivore group. Source-tracking analysis showed that the contributions of bacteria from maternal milk to the microbiota of neonates of different mammals were different at day 3 after neonatal birth. Overall, our findings provided a theoretical basis for the maternal milk microbiota to affect neonatal fecal microbiota at day 3 after neonatal birth.