From 920fd369e914ad328b0ecd32dba4eb6a982901ed Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 7 Nov 2007 09:12:30 +0000 Subject: [PATCH] =?utf8?q?Beim=20Verschicken=20von=20Emails=20wird=20das?= =?utf8?q?=20Kommando=20$sendmail=20durch=20Lx-Offices=20Template-System?= =?utf8?q?=20geschleust.=20Vordefiniert=20ist,=20dass=20Sendmail=20der=20P?= =?utf8?q?arameter=20"-f=20emailadresse"=20mitgegeben=20wird,=20sodass=20d?= =?utf8?q?ie=20Envelope-From-Adresse=20die=20des=20aktuellen=20Lx-Office-B?= =?utf8?q?enutzers=20und=20nicht=20die=20des=20Webservers=20ist.=20Das=20v?= =?utf8?q?ermeidet,=20dass=20Emails=20wegen=20Spam/nicht=20existierender?= =?utf8?q?=20Dom=C3=A4nennamen=20von=20Providern=20abgelehnt=20wedren.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Mailer.pm | 26 +++++++++++++++++++------- lx-erp.conf | 2 +- lx-erp.conf.default | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 5123babb9..35cc57a75 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -31,6 +31,7 @@ package Mailer; use SL::Common; +use SL::Template; sub new { $main::lxdebug->enter_sub(); @@ -93,17 +94,28 @@ sub send { local (*IN, *OUT); - my $boundary = time; - $boundary = "LxOffice-$self->{version}-$boundary"; - my $domain = $self->{from}; - $domain =~ s/(.*?\@|>)//g; - my $msgid = "$boundary\@$domain"; + my $boundary = time(); + $boundary = "LxOffice-$self->{version}-$boundary"; + my $domain = $self->{from}; + $domain =~ s/(.*?\@|>)//g; + my $msgid = "$boundary\@$domain"; + + my $form = $main::form; + my $myconfig = \%main::myconfig; + + my $email = $myconfig->{email}; + $email =~ s/[^\w\.\-\+=@]//ig; + + $form->{myconfig_email} = $email; + + my $template = PlainTextTemplate->new(undef, $form, $myconfig); + my $sendmail = $template->parse_block($main::sendmail); $self->{charset} = Common::DEFAULT_CHARSET unless $self->{charset}; - if (!open(OUT, $main::sendmail)) { + if (!open(OUT, $sendmail)) { $main::lxdebug->leave_sub(); - return "$main::sendmail : $!"; + return "$sendmail : $!"; } $self->{contenttype} = "text/plain" unless $self->{contenttype}; diff --git a/lx-erp.conf b/lx-erp.conf index b8d023099..abea4797a 100644 --- a/lx-erp.conf +++ b/lx-erp.conf @@ -17,7 +17,7 @@ $memberfile = "users/members"; $eur= 1; # location of sendmail -$sendmail = "| /usr/sbin/sendmail -t"; +$sendmail = '| /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%>'; # set language for login and admin $language = "de"; diff --git a/lx-erp.conf.default b/lx-erp.conf.default index b8d023099..abea4797a 100644 --- a/lx-erp.conf.default +++ b/lx-erp.conf.default @@ -17,7 +17,7 @@ $memberfile = "users/members"; $eur= 1; # location of sendmail -$sendmail = "| /usr/sbin/sendmail -t"; +$sendmail = '| /usr/sbin/sendmail -t<%if myconfig_email%> -f <%myconfig_email%><%end%>'; # set language for login and admin $language = "de"; -- 2.20.1