[IMP]mail: improve code