enupal / backup

Fully integrated Backup solution for Craft CMS
https://enupal.com/craft-plugins/enupal-backup
Other
16 stars 3 forks source link

Feature Request: Notification for Failed Backups #15

Closed kmgdevelopment closed 5 years ago

kmgdevelopment commented 5 years ago

It would be great to have a setting where the plugin will send an email if the backup fails. Getting an email if the backup is successful is less useful, since you start to ignore it after a while.

andrelopez commented 5 years ago

Hi @kgrote

Thanks for reaching out. Adding twig logic the "Subject" setting to add a proper message would work? e.g

{% if backup.getStatusName() == 'Finished' %} Backup successful {% else %} Backup Error {% endif %}

You can also modify the "Email Recipients" setting or any other using the EVENT_BEFORE_SEND_NOTIFICATION_EMAIL fired after a Backup is finished. Please see a full example here

You may need to update to Enupal Backup v1.2.6 to get the $backup in the event.