created loop for reading in emails