Added ability to disable mail function