How do I erase an iPhone?
To erase everything and restore the iPhone to the factory state, go into Settings, then General, then Reset. Press "Erase All Content and Settings". If you have a passcode, you will be prompted to enter it. Select "Erase iPhone" and the wipe will begin. Be sure to have your iPhone connected to a power source as the erase takes a long time. When it's complete, the iPhone will have no SMS, calendar, phone logs, contacts, etc.