Custom email templates

for #753 

- [x] custom HTML templates for emails, generic or specific to trigger type
- [x] markdown support
- [x] output logs can be attached to emails