The Time Machine backup will save everything. Below are links to the path you would take. Use the Erase option in the third link before reinstalling. Take note when reinstalling it will take a while to download the installer, it's a few gigs in size.https://support.apple.com/en-us/HT201250https://support.apple.com/en-us/HT201314https://support.apple.com/en-us/HT204904
Follow the links in the links above to show how to erase and reinstall.
If you want it totally clean, manually reinstall apps, and migrate manually from Time Machine, and want to restore Mail manually it's a little tricky, let me know if that's what you want to do.
if you restore automatically from TM I would suggest not restoring System and Network settings, you'll see the choices come up at the beginning of the Restore process.
Scroll down to Select Items to Migrate in this link;http://pondini.org/OSX/MigrateLion.html
Also it may be good to not Restore applications, it may bring over stuff that is slowing it up, only the User/s. You can then reinstall the apps.
Let me know which course you want to take we can go into more detail.