extract mail handling to utils class