Added php code to generate emails