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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 13 08:11:04 CEST 2017


On 09/08/2017 02:56 PM, Philip Abernethy wrote:
> Using the nodename is not correct and can lead to mails not forwarding
> in restrictive mail server configurations.
> ---
>   src/PVE/HA/Env/PVE2.pm | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
> index fdfadd7..722d1b7 100644
> --- a/src/PVE/HA/Env/PVE2.pm
> +++ b/src/PVE/HA/Env/PVE2.pm
> @@ -204,8 +204,8 @@ sub log {
>   sub sendmail {
>       my ($self, $subject, $text) = @_;
>   
> -    my $mailfrom = 'root@' . $self->nodename();
> -    my $mailto = 'root at localhost';
> +    my $mailfrom = 'root';
> +    my $mailto = 'root';

needs this to change? root at localhost worked as intended not for "mailto"?

A comment would be nice too if we take this approach, so that the
unsuspecting reader may understand that while both values are root they
mean something different when resolved by pvemailforward...

Besides that looks OK.

But I'd still like to see the sendmail function a bit  adapted so that this
is possible:

sendmail($subject, text => $foo);  # send to root configured email a plain text mail with roots or dc->email_from as from
sendmail($subject, text => $foo, html => $bar); # same but also a HTML part
sendmail($subject, to => $backup_mail, text => $foo, html => $bar); # same as above but a custom "to" (e.g. for backups)

Seems like a nicer interface for the user to me, thoughts?

>   
>       PVE::Tools::sendmail($mailto, $subject, $text, undef, $mailfrom);
>   }
> 






More information about the pve-devel mailing list