Revision 11e0660f
Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt
SL/Mailer.pm | ||
---|---|---|
124 | 124 |
$num_sent++; |
125 | 125 |
my $boundary = time() . "-$$-${num_sent}"; |
126 | 126 |
$boundary = "kivitendo-$self->{version}-$boundary"; |
127 |
my $domain = $self->recode($self->{from});
|
|
127 |
my $domain = $self->{from};
|
|
128 | 128 |
$domain =~ s/(.*?\@|>)//g; |
129 | 129 |
my $msgid = "$boundary\@$domain"; |
130 | 130 |
|
... | ... | |
142 | 142 |
|
143 | 143 |
foreach my $item (qw(to cc bcc)) { |
144 | 144 |
next unless ($self->{$item}); |
145 |
$self->{$item} = $self->recode($self->{$item}); |
|
146 | 145 |
$self->{$item} =~ s/\</</g; |
147 | 146 |
$self->{$item} =~ s/\$<\$/</g; |
148 | 147 |
$self->{$item} =~ s/\>/>/g; |
149 | 148 |
$self->{$item} =~ s/\$>\$/>/g; |
150 | 149 |
} |
151 | 150 |
|
152 |
$self->{from} = $self->recode($self->{from}); |
|
153 |
|
|
154 | 151 |
my %addresses; |
155 | 152 |
my $headers = ''; |
156 | 153 |
foreach my $item (qw(from to cc bcc)) { |
... | ... | |
173 | 170 |
} |
174 | 171 |
} |
175 | 172 |
|
176 |
$headers .= sprintf("Subject: %s\n", $self->mime_quote_text($self->recode($self->{subject}), 60));
|
|
173 |
$headers .= sprintf("Subject: %s\n", $self->mime_quote_text($self->{subject}, 60));
|
|
177 | 174 |
|
178 | 175 |
$driver->start_mail(from => $self->{from}, to => [ map { @{ $addresses{$_} } } qw(to cc bcc) ]); |
179 | 176 |
|
... | ... | |
188 | 185 |
$driver->print(qq|--${boundary} |
189 | 186 |
Content-Type: $self->{contenttype}; charset="$self->{charset}" |
190 | 187 |
|
191 |
| . $self->recode($self->{message}) . qq|
|
|
188 |
$self->{message}
|
|
192 | 189 |
|
193 | 190 |
|); |
194 | 191 |
} |
... | ... | |
236 | 233 |
} else { |
237 | 234 |
$driver->print(qq|Content-Type: $self->{contenttype}; charset="$self->{charset}" |
238 | 235 |
|
239 |
| . $self->recode($self->{message}) . qq|
|
|
236 |
$self->{message}
|
|
240 | 237 |
|); |
241 | 238 |
} |
242 | 239 |
|
... | ... | |
275 | 272 |
return $res; |
276 | 273 |
} |
277 | 274 |
|
278 |
sub recode { |
|
279 |
my $self = shift; |
|
280 |
my $text = shift; |
|
281 |
|
|
282 |
return $::locale->is_utf8 ? Encode::encode('utf-8-strict', $text) : $text; |
|
283 |
} |
|
284 |
|
|
285 | 275 |
1; |
Auch abrufbar als: Unified diff
Bei Verwendung von SMTP nicht doppelt nach UTF-8 encoden
Die SMTP-Module erwarten, dass die Strings im Perl-internen Encoding
vorliegen. Das tun sie in Mailer.pm auch schon, allerdings wurden sie
dort bisher nach UTF-8 encodiert, weil der Sendmail-Treiber es so
brauchte.
Also die richtige Variante:
- Mailer.pm verändert das Encoding nicht
- Mailer/Sendmail.pm setzt :utf8 als I/O-Layer auf der Pipe zum externen Prozess
Behebt #2035.