add email alert function.