added code for sending an email