Added the methods to send email by ajax

I added the missing methods to send email. Also I cleaned code and did refactoring.