add mail functionality, add integrational tests