Möglichkeit eingebaut, den Namen des Anhangs einer verschickten Mail anzugeben.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 26 Jan 2007 16:00:20 +0000 (16:00 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 26 Jan 2007 16:00:20 +0000 (16:00 +0000)
SL/Form.pm
SL/Mailer.pm

index 5452a32..9a992bd 100644 (file)
@@ -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;
index 453603f..37d98b7 100644 (file)
@@ -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