aligned plugins/notification to latest changes and fix in utils.py

this pull request fixed a misalignment in utils.py and plugins/notification.py
latest changes prevented notification to happen correctly.

the code is the same as copied from the exception handling code with no additions so it should be safe (it reflects latest @hellais fix entirely)

there is some code common to the plugin and to the mail_exception function that probably can be refactored putting it inside the sendmail function.

by the way please do not do this now as we need simply to stabilize the code.

@vecna / @hellais one of you can please review and merge this?