Although network analysis has drawn considerable attention as a promising tool for disease ecology, empirical research has been hindered by limitations in detecting the occurrence of pathogen transmission (who transmitted to whom) within social networks. Using a novel approach, we utilize the genetics of a diverse microbe, Escherichia coli, to infer where direct or indirect transmission has occurred and use these data to construct transmission networks for a wild giraffe population (Giraffe camelopardalis). Individuals were considered to be a part of the same transmission chain and were interlinked in the transmission network if they shared genetic subtypes of E. coli. By using microbial genetics to quantify who transmits to whom independently from the behavioural data on who is in contact with whom, we were able to directly investigate how the structure of contact networks influences the structure of the transmission network. To distinguish between the effects of social and environmental contact on transmission dynamics, the transmission network was compared with two separate contact networks defined from the behavioural data: a social network based on association patterns, and a spatial network based on patterns of home-range overlap among individuals. We found that links in the transmission network were more likely to occur between individuals that were strongly linked in the social network. Furthermore, individuals that had more numerous connections or that occupied 'bottleneck' positions in the social network tended to occupy similar positions in the transmission network. No similar correlations were observed between the spatial and transmission networks. This indicates that an individual's social network position is predictive of transmission network position, which has implications for identifying individuals that function as super-spreaders or transmission bottlenecks in the population. These results emphasize the importance of association patterns in understanding transmission dynamics, even for environmentally transmitted microbes like E. coli. This study is the first to use microbial genetics to construct and analyse transmission networks in a wildlife population and highlights the potential utility of an approach integrating microbial genetics with network analysis.