In this thesis I summarize my research related to the impact of the environment during generation, propagation, and detection of nonclassical light. First, I will analyse unwanted effects in light sources, which are implemented with leaky cavities. Second, I will consider effects of imperfect photodetection. Third, I will present our theoretical consideration of free-space channels, which is the first self-consistent quantum-optical model involving the atmospheric turbulence.