update worker email functions and add tests