- # Leave it to postfix to append the correct hostname
- my $mailfrom = 'root';
- # /root/.forward makes pvemailforward redirect the
- # mail to the address configured in the datacenter
- my $mailto = 'root';
+ eval {
+ my $dc_config = PVE::Cluster::cfs_read_file('datacenter.cfg');
+ my $target = $dc_config->{notify}->{'target-fencing'} // PVE::Notify::default_target();
+ my $notify = $dc_config->{notify}->{fencing} // 'always';
+
+ if ($notify eq 'always') {
+ PVE::Notify::error($target, $subject, $text, $properties);
+ }
+ };