Moved email sending code to shared code and amended to use ScriptMail due to new ISP restrictions.