Solar Flare Electron Spectra at the Sun and near the Earth