]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
fix #1347: let postfix fill in FQDN in fence mails
authorPhilip Abernethy <p.abernethy@proxmox.com>
Thu, 14 Sep 2017 12:39:33 +0000 (14:39 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 25 Sep 2017 13:39:10 +0000 (15:39 +0200)
Using the nodename in $mailto is not correct and can lead to mails not
forwarding in restrictive mail server configurations.
Also changes $mailfrom to 'root' instead of 'root@localhost', which
results in postfix appending the proper FQDN there, too. As a result the
Delivered-to header reads something like 'root@host.domain.tld' instead
of 'root@localhost', which is much more informational and more
consistent.

Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Env/PVE2.pm

index fdfadd7ca3efacad38e01ad47e4386380b4dd4b2..8baf2d01ef6f899996ea17bca8197d7544919193 100644 (file)
@@ -204,8 +204,11 @@ sub log {
 sub sendmail {
     my ($self, $subject, $text) = @_;
 
-    my $mailfrom = 'root@' . $self->nodename();
-    my $mailto = 'root@localhost';
+    # 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';
 
     PVE::Tools::sendmail($mailto, $subject, $text, undef, $mailfrom);
 }