X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/231412071142f1ca5a20d86fb5e090b795400996..69822fd215cb15e1bb017f1af6f0a185f62a31e2:/SL/Mailer.pm diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 453603ff1..aec34e67d 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -30,6 +30,8 @@ package Mailer; +use SL::Common; + sub new { $main::lxdebug->enter_sub(); @@ -95,7 +97,7 @@ sub send { $domain =~ s/(.*?\@|>)//g; my $msgid = "$boundary\@$domain"; - $self->{charset} = "ISO-8859-15" unless $self->{charset}; + $self->{charset} = Common::DEFAULT_CHARSET unless $self->{charset}; if ($out) { if (!open(OUT, $out)) { @@ -147,6 +149,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 +172,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