There is such a setting. Search ‘disable email’.
See also Troubleshoot email on a new Discourse install - #362