Refactor code based on feature clarification for sending email and emaildigest if notification settings are enabled