fix mailer generation to handle nested apps

in relation to #1011
Merge pull request #1060 from tyabe/fix_mailer_generation

fix mailer generation to handle nested apps