genouest / biomaj

BioMAJ
http://genouest.github.io/biomaj/
GNU Affero General Public License v3.0
12 stars 10 forks source link

Allow custom email notifications #119

Closed shenne-ls closed 4 years ago

shenne-ls commented 4 years ago

So far, BioMAJ email notication consists of a simple mail looking like this:

From:   Author <biomaj@biomaj.com>
Sent:   lundi 9 mars 2020 01:27
To: John Doe
Subject:    BANK[entrezgene] - STATUS[True] - UPDATE[True] - REMOVE[True] - RELEASE[2020-3-8]

2020-03-09 00:10:06,696 INFO  [root][MainThread] Log file: 
/biomaj/logs/entrezgene/1583709006.6204774/entrezgene.log
2020-03-09 00:10:06,699 WARNI [root][MainThread] Bank:entrezgene:Update
2020-03-09 00:10:06,754 INFO  [root][MainThread] Bank:entrezgene:Release:latest
2020-03-09 00:10:06,754 DEBUG [root][MainThread] Start new session
...
2020-03-09 01:27:02,836 INFO  [root][MainThread] Workflow:wf_over
2020-03-09 01:27:02,912 DEBUG [root][MainThread] Bank:Save:entrezgene
2020-03-09 01:27:02,992 INFO  [root][MainThread] 
Notify:john.doe@biomaj.com

It would be nice to be able to customize those emails in various ways:

This would make this email much more valuable for an end-user target audience.

osallou commented 4 years ago

regarding mail destination, it is possible to send to different users, per bank via config param mail.admin , with a comma separated list

in global.properties you can set:

mail.admin=admin@you

in a specific bank property set you can override:

mail.admin=admin@you,someoneelse@somewhere
osallou commented 4 years ago

Regarding the from, it is taken from config mail.from (customizable per bank if needed)

osallou commented 4 years ago

Author changed to BioMAJ for using jinja2 templates for header/body of message and options to include tail of log_file and/or attach log file to mail, see smtp options in docs/global.advanced.properties