[task] refactore mail and template function, update controller tests
Merge pull request #147 from dacrome/OSNG-354-356

[task] refactore mail and template function, update controller tests