Fix a refactor bug for sending of emails.