From: Moritz Bunkus Date: Wed, 7 Nov 2007 09:12:30 +0000 (+0000) Subject: Beim Verschicken von Emails wird das Kommando $sendmail durch Lx-Offices Template... X-Git-Tag: release-2.6.0beta1~421 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=920fd369e914ad328b0ecd32dba4eb6a982901ed;p=kivitendo-erp.git Beim Verschicken von Emails wird das Kommando $sendmail durch Lx-Offices Template-System geschleust. Vordefiniert ist, dass Sendmail der Parameter "-f emailadresse" mitgegeben wird, sodass die Envelope-From-Adresse die des aktuellen Lx-Office-Benutzers und nicht die des Webservers ist. Das vermeidet, dass Emails wegen Spam/nicht existierender Domänennamen von Providern abgelehnt wedren. --- 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";