Added ability for script to send emails