Copmplete send mail function.
Move log after send success.
Merge branch 'release/0.2'