Email functionality JS changes