refactor mailcollect and pma