From: Moritz Bunkus Date: Mon, 7 Jul 2008 17:55:39 +0000 (+0000) Subject: Email-Versand: Adressen beim Quoten nicht umbrechen. X-Git-Tag: release-2.6.0beta1~71 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=77733865782a76d067540b70304ff3dab7a1ab8c;p=kivitendo-erp.git Email-Versand: Adressen beim Quoten nicht umbrechen. --- diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 52691e277..e9665caac 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -57,30 +57,29 @@ sub mime_quote_text { my $l_start = length($q_start); my $new_text = "$q_start"; - $chars_left -= $l_start; + $chars_left -= $l_start if (defined $chars_left); for (my $i = 0; $i < length($text); $i++) { my $char = ord(substr($text, $i, 1)); - if (($char < 32) || ($char > 127) || - ($char == ord('?')) || ($char == ord('_'))) { - if ($chars_left < 5) { + if (($char < 32) || ($char > 127) || ($char == ord('?')) || ($char == ord('_'))) { + if ((defined $chars_left) && ($chars_left < 5)) { $new_text .= "?=\n $q_start"; $chars_left = 75 - $l_start; } $new_text .= sprintf("=%02X", $char); - $chars_left -= 3; + $chars_left -= 3 if (defined $chars_left); } else { $char = ord('_') if ($char == ord(' ')); - if ($chars_left < 5) { + if ((defined $chars_left) && ($chars_left < 5)) { $new_text .= "?=\n $q_start"; $chars_left = 75 - $l_start; } $new_text .= chr($char); - $chars_left--; + $chars_left-- if (defined $chars_left); } } @@ -138,8 +137,12 @@ sub send { next unless (scalar @addr_objects); foreach my $addr_obj (@addr_objects) { - $addr_obj->phrase($self->mime_quote_text($addr_obj->phrase(), 60)) if ($addr_obj->phrase()); - $addr_obj->comment($self->mime_quote_text($addr_obj->comment(), 60)) if ($addr_obj->comment()); + my $phrase = $addr_obj->phrase(); + if ($phrase) { + $phrase =~ s/^\"//; + $phrase =~ s/\"$//; + $addr_obj->phrase($self->mime_quote_text($phrase)); + } $headers .= sprintf("%s: %s\n", ucfirst($item), $addr_obj->format()); }