From 3d7797630e04ddb308b11a58cd9732d502029125 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 26 Jan 2007 16:00:20 +0000 Subject: [PATCH] =?utf8?q?M=C3=B6glichkeit=20eingebaut,=20den=20Namen=20de?= =?utf8?q?s=20Anhangs=20einer=20verschickten=20Mail=20anzugeben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 7 ++++++- SL/Mailer.pm | 16 +++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 5452a3221..9a992bd3a 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -839,7 +839,12 @@ sub parse_template { } else { - @{ $mail->{attachments} } = ($self->{tmpfile}) unless ($self->{do_not_attach}); + if (!$self->{"do_not_attach"}) { + @{ $mail->{attachments} } = + ({ "filename" => $self->{"tmpfile"}, + "name" => $self->{"attachment_filename"} ? + $self->{"attachment_filename"} : $self->{"tmpfile"} }); + } $mail->{message} =~ s/\r\n/\n/g; $myconfig->{signature} =~ s/\\n/\n/g; diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 453603ff1..37d98b7a7 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -147,6 +147,17 @@ $self->{message} foreach my $attachment (@{ $self->{attachments} }) { + my $filename; + + if (ref($attachment) eq "HASH") { + $filename = $attachment->{"name"}; + $attachment = $attachment->{"filename"}; + } else { + $filename = $attachment; + # strip path + $filename =~ s/(.*\/|$self->{fileid})//g; + } + my $application = ($attachment =~ /(^\w+$)|\.(html|text|txt|sql)$/) ? "text" @@ -159,11 +170,6 @@ $self->{message} return "$attachment : $!"; } - my $filename = $attachment; - - # strip path - $filename =~ s/(.*\/|$self->{fileid})//g; - print OUT qq|--${boundary} Content-Type: $application/$self->{format}; name="$filename"; charset="$self->{charset}" Content-Transfer-Encoding: BASE64 -- 2.20.1