The difference ($E_2-E_1$)in electronic energy levels gives the energy that the photon would have if the atom were held stationary. If the atom is allowed to recoil, the photon energy will be $(E_2-E_1)$ minus the recoil energy.
But the recoil energy is only about $10^{-9}$ of the photon energy, so the reduction in photon energy is pretty negligible!
Since the atom's recoil momentum, $p$, is equal and opposite to the photon momentum, $h/\lambda$,
$$E_{k\ atom}=\frac{p^2}{2m_{atom}} = \frac{1}{2m_{atom}} {\left(\frac {h} {\lambda}\right)}^2=\frac{1}{2m_{atom}\ c^2} {\left(\frac {hc} {\lambda}\right)}^2=\frac {E_{phot}^2}{2m_{atom}\ c^2} $$
So
$$\frac{E_{k\ atom}}{E_{phot}}=\frac {E_{phot}}{2m_{atom}\ c^2} \approx \frac {1.9\ \text{eV}}{2 \times 931\ \text{ MeV}}$$