Exit mail using the "x" command
Using the x command leaves your mailbox untouched:
Messages that you have read will still be marked as unread.
Messages marked for deletion will not be deleted.