Microscopic calculation of the electron-phonon interaction in quantum wells