add mail handler to record error log