Use templates to generate the emails for all submission types
Fix some PEP8 errors