1. adjust code structure;2.add data process; 3. log and send mail