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 'r...@host.domain.tld' instead of 'root@localhost', which is much more informational and more consistent. --- src/PVE/HA/Env/PVE2.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm index fdfadd7..8baf2d0 100644 --- a/src/PVE/HA/Env/PVE2.pm +++ b/src/PVE/HA/Env/PVE2.pm @@ -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); } -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel