added emailing functionality