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