Subject: | No name for attached files |
Hello,
When I receive the mail I don't have any filename for my mail reader to
deal with. So it doesn't know what to do with attached files and only
ask me to save "attachement".
Here is the patch. I hope you'll be able to use it.
Subject: | Multipart.patch |
--- Multipart.pm 2002-11-11 13:13:29.000000000 +0100
+++ /usr/local/share/perl/5.8.8/Net/SMTP/Multipart.pm 2006-03-02 15:47:20.000000000 +0100
@@ -74,7 +74,9 @@
sub FileAttach {
my $self = shift;
- foreach my $file (@_) {
+ my $file;
+ my $filename;
+ for $file (@_) {
unless (-f $file) {
carp 'Net::SMTP::Multipart:FileAttach: unable to find file $file';
next;
@@ -99,11 +101,16 @@
#print "File Size: $total bytes\n";
close FH;
+ # Keep only basename
+ $filename = $file;
+ $filename =~ s/^.*\/(.*?)/$1/;
+
if ($data){
$self->datasend("--$b\n");
- $self->datasend("Content-Type: ; name=\"$file\"\n");
+ $self->datasend("Content-Type: application/octet-stream; name=\"$filename\"\n");
$self->datasend("Content-Transfer-Encoding: base64\n");
- $self->datasend("Content-Disposition: attachment; =filename=\"$file\"\n\n");
+ $self->datasend("Content-Description: $filename\n");
+ $self->datasend("Content-Disposition: attachment; filename=\"$filename\"\n\n");
$self->datasend(encode_base64($data));
$self->datasend("--$b\n");
}