diff --git a/mailboxes/CHANGELOG b/mailboxes/CHANGELOG index 486a30e7e..e045eeddb 100644 --- a/mailboxes/CHANGELOG +++ b/mailboxes/CHANGELOG @@ -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. diff --git a/mailboxes/reply_mail.cgi b/mailboxes/reply_mail.cgi index 7096a3590..0ebe46ee3 100755 --- a/mailboxes/reply_mail.cgi +++ b/mailboxes/reply_mail.cgi @@ -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 diff --git a/mailboxes/send_mail.cgi b/mailboxes/send_mail.cgi index 5b9a99091..288497e2a 100755 --- a/mailboxes/send_mail.cgi +++ b/mailboxes/send_mail.cgi @@ -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++; diff --git a/mailboxes/view_mail.cgi b/mailboxes/view_mail.cgi index c111f1dd0..be719eb72 100755 --- a/mailboxes/view_mail.cgi +++ b/mailboxes/view_mail.cgi @@ -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();