Added mailing module for notifications.
Added mail feature and minor refactoring.