Refactor mail receiver polling loop