Fix order of alternative parts
authorJamie Cameron <jcameron@webmin.com>
Sun, 29 Nov 2009 05:25:03 +0000 (21:25 -0800)
committerJamie Cameron <jcameron@webmin.com>
Sun, 29 Nov 2009 05:25:03 +0000 (21:25 -0800)
mailboxes/CHANGELOG
mailboxes/send_mail.cgi

index cfbd051..867460a 100644 (file)
@@ -64,3 +64,6 @@ Messages with alternate HTML and text bodies are now send with the multipart/alt
 The original sender's email address is now included in the 'wrote' line when replying to or forwarding a message.
 ---- Changes since 1.480 ----
 Mail with HTML and text bodies now uses a multipart/alternative sub-attachment, so that other attachments are shown properly in mail clients like Hotmail and Yahoo.
+---- Changes since 1.490 ----
+Put text/plain alternative body part before text/html, to be compliant with RFC
+2046.
index dec9892..b5a0fa8 100755 (executable)
@@ -102,14 +102,14 @@ if ($in{'body'} =~ /\S/) {
                local @alts = ( $attach[0] );
                local $mt = "text/plain; charset=$charset";
                if ($plainbody =~ /[\177-\377]/) {
-                       push(@alts,
+                       unshift(@alts,
                          { 'headers' => [ [ 'Content-Type', $mt ],
                                           [ 'Content-Transfer-Encoding',
                                             'quoted-printable' ] ],
                            'data' => quoted_encode($plainbody) });
                        }
                else {
-                       push(@alts,
+                       unshift(@alts,
                          { 'headers' => [ [ 'Content-Type', $mt ],
                                           [ 'Content-Transfer-Encoding',
                                             '7bit' ] ],