The Correlation Energy of the Electron Gas in the Mean-Field Regime