Send Email - added email templates and made sendEmail generic function