Many infectious agents transmitting through a contaminated environment are able to persist in the environment depending on the temperature and sanitation determined rates of their replication and clearance, respectively. There is a need to elucidate the effect of these factors on the infection transmission dynamics in terms of infection outbreaks and extinction while accounting for the random nature of the process. Also, it is important to distinguish between the true and apparent extinction, where the former means pathogen extinction in both the host and the environment while the latter means extinction only in the host population. This study proposes a stochastic-differential equation model as an approximation to a Markov jump process model, using Escherichia coli O157:H7 in cattle as a model system. In the model, the host population infection dynamics are described using the standard susceptible-infected-susceptible framework, and the E. coli O157:H7 population in the environment is represented by an additional variable. The backward Kolmogorov equations that determine the probability distribution and the expectation of the first passage time are provided in a general setting. The outbreak and apparent extinction of infection are investigated by numerically solving the Kolmogorov equations for the probability density function of the associated process and the expectation of the associated stopping time. The results provide insight into E. coli O157:H7 transmission and apparent extinction, and suggest ways for controlling the spread of infection in a cattle herd. Specifically, this study highlights the importance of ambient temperature and sanitation, especially during summer. © 2013 Springer-Verlag Berlin Heidelberg.