[pve-devel] [PATCH 3/3] email_from: apply $mailfrom changes for pvemailforward.pl

Stanislav German-Evtushenko ginermail at gmail.com
Thu Sep 4 13:53:19 CEST 2014


Signed-off-by: Stanislav German-Evtushenko <ginermail at gmail.com>
---
 bin/pvemailforward.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bin/pvemailforward.pl b/bin/pvemailforward.pl
index 53b58a0..2f807e4 100755
--- a/bin/pvemailforward.pl
+++ b/bin/pvemailforward.pl
@@ -24,12 +24,15 @@ eval {
     my $rootcfg = $usercfg->{users}->{'root at pam'} || {};
     my $mailto = $rootcfg->{email};
 
+    my $dcconf = cfs_read_file('datacenter.cfg');
+    my $mailfrom = $dcconf->{email_from} || "root";
+
     die "user 'root\@pam' does not have a email address\n" if !$mailto;
 
     syslog("info", "forward mail to <$mailto>");
 
     # we never send DSN (avoid mail loops)
-    open(CMD, "|sendmail -bm -N never $mailto") ||
+    open(CMD, "|sendmail -bm -N never -f $mailfrom $mailto") ||
 	die "can't exec sendmail - $!\n";
     while (<>) { print CMD $_; }
     close(CMD);
-- 
1.9.1




More information about the pve-devel mailing list