Fix email sending, Fix javascript bug on add and delete event, removed trailing white spaces

Hi, created a pull request for the dev branch as well, removed some trailing spaces in addition to the master pull