More mail checking refactoring