Retrieve mail details from database