We present easily reproducible experimental conditions giving long electron spin relaxation and dephasing times at low temperature in a quantum well. The proposed system consists in an electron localized by a donor potential, and immerged in a quantum well in order to improve its localization with respect to donor in bulk. We have measured, by using photoinduced Faraday rotation technique, the spin relaxation and dephasing times of electrons localized on donors placed in the middle of a 80A CdTe quantum well, and we have obtained 15ns and 18ns, respectively, which are almost two orders of magnitude longer than the free electron spin relaxation and dephasing times obtained previously in a similar CdTe quantum well (J. Tribollet et al. PRB 68, 235316 (2003)).