summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-17 20:29:11 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-17 20:29:11 +0000
commitadcfdc786db5f433fdbac28a3a2495bf786fb681 (patch)
treec41d5b375c19c3415cfd60c51e1558b0ba9fb426
parente66caef35fdb20d9f5f2b43d915016ef7f6be18a (diff)
A little charset cleanup and removing an outdated hash
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1774 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/Mailer.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/LedgerSMB/Mailer.pm b/LedgerSMB/Mailer.pm
index 32d16ab3..0266d4b3 100755
--- a/LedgerSMB/Mailer.pm
+++ b/LedgerSMB/Mailer.pm
@@ -59,27 +59,25 @@ sub send {
$self->{contenttype} = "text/plain" unless $self->{contenttype};
my $msgid = "$boundary\@$domain";
- my %h;
for (qw(from to cc bcc)) {
$self->{$_} =~ s/\&lt;/</g;
$self->{$_} =~ s/\&gt;/>/g;
$self->{$_} =~ s/(\/|\\|\$)//g;
- $h{$_} = $self->{$_};
}
- $h{subject} = "Subject: ".Encode::encode('MIME-Header', $self->{subject});
-
my $msg = MIME::Lite->new(
'From' => $self->{from},
'To' => $self->{to},
'Cc' => $self->{cc},
'Bcc' => $self->{bcc},
- 'Subject' => $self->{subject},
+ 'Subject' => Encode::encode('MIME-Header', $self->{subject}),
'Type' => 'TEXT',
'Data' => $self->{message},
'Message-ID' => $msg_id,
);
$msg->attr("Content-Type" => $self->{contenttype});
+ $msg->attr("Content-Type.charset" => 'UTF-8') if
+ $self->{contenttype} =~ m#^text/#;
$msg->add( 'Disposition-Notification-To' => $self->{from} )
if $self->{notify};
$msg->replace( 'X-Mailer' => "LedgerSMB $self->{version}" );
@@ -93,11 +91,13 @@ sub send {
: "application";
my $filename = $attachment;
+ my $type = "$application/$self->{format}";
+ $type .= '; charset="UTF-8"' if $application eq 'text';
# strip path
$filename =~ s/(.*\/|$self->{fileid})//g;
$msg->attach(
- 'Type' => "$application/$self->{format}",
+ 'Type' => $type,
'Path' => $attachment,
'Filename' => $filename,
'Disposition' => 'attachment',