added mailcontroller

Added mailcontroller
+ small other changes