added emailing, with proper tests