mail at each cron + log and mail refactor