Optimization to improve speed of finding flagged messages. Only consider messages that are flagged rather than looping over entire inbox.