refactoring notification sendmail