Moved the test check for email sending