[pve-devel] [PATCH ha-manager v2] fix #1347: let postfix fill in FQDN in fence mails

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 25 15:34:24 CEST 2017


On 09/14/2017 02:39 PM, Philip Abernethy wrote:
> 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 at localhost', which
> results in postfix appending the proper FQDN there, too. As a result the
> Delivered-to header reads something like 'root at host.domain.tld' instead
> of 'root at 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 at 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);
>   }
> 

Looks ok:
Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>




More information about the pve-devel mailing list