Added condition to check response status code and send an email