Use charset from email when displaying and replying

This commit is contained in:
Jamie Cameron
2009-03-26 18:38:47 +00:00
parent 62c4eb2ed0
commit 8d1e625f0a
4 changed files with 15 additions and 3 deletions

View File

@@ -58,3 +58,6 @@ Re-wrote the entire user interface to use the new Webmin UI library, and to brin
HTML messages now have a converted plain-text attachment automatically added, for mail clients that only support text.
---- Changes since 1.450 ----
Added Module Config options to not include the X-Mailer and X-Originating-IP headers in sent mail.
---- Changes since 1.470 ----
When replying to a message, the original character set is used. Also, a bug that prevented the character set from being displayed when viewing a message is fixed.
Messages with alternate HTML and text bodies are now send with the multipart/alternative content type, which fixes the problem of Gmail showing the body twice.

View File

@@ -53,6 +53,11 @@ else {
&check_modification($folder) if ($in{'delete'});
$mail || &error($text{'mail_eexists'});
# Find the body parts and set the character set
($textbody, $htmlbody, $body) =
&find_body($mail, $config{'view_html'});
$main::force_charset = &get_mail_charset($mail, $body);
if ($in{'delete'}) {
# Just delete the email
if (!$in{'confirm'} && &need_delete_warn($folder)) {
@@ -87,8 +92,6 @@ else {
elsif ($in{'print'}) {
# Show email for printing
&decode_and_sub();
($textbody, $htmlbody, $body) =
&find_body($mail, $config{'view_html'});
&ui_print_header(undef, &decode_mimewords(
$mail->{'header'}->{'subject'}));
&show_mail_printable($mail, $body, $textbody, $htmlbody);
@@ -339,6 +342,7 @@ print &ui_hidden("enew", $in{'enew'});
foreach $s (@sub) {
print &ui_hidden("sub", $s);
}
print &ui_hidden("charset", $main::force_charset);
# Start tabs for from / to / cc / bcc
# Subject is separate

View File

@@ -76,6 +76,9 @@ if ($in{'body'} =~ /\S/) {
}
}
local $mt = $in{'html_edit'} ? "text/html" : "text/plain";
if ($in{'charset'}) {
$mt .= "; charset=$in{'charset'}";
}
if ($in{'body'} =~ /[\177-\377]/) {
# Contains 8-bit characters .. need to make quoted-printable
$quoted_printable++;

View File

@@ -3,7 +3,6 @@
# View a single email message
require './mailboxes-lib.pl';
$main::force_charset = '';
&ReadParse();
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
if (&is_user($in{'user'})) {
@@ -62,6 +61,9 @@ if ($body && $body eq $htmlbody) {
$headstuff = &head_html($body->{'data'});
}
# Set the character set for the page to match email
$main::force_charset = &get_mail_charset($mail, $body);
&mail_page_header($text{'view_title'}, $headstuff, undef,
&folder_link($in{'user'}, $folder));
print &check_clicks_function();