[Rt-commit] rt branch, 5.0/headers-in-alternative-email, created. rt-5.0.0alpha1-104-g1f9fdb66c1

Jim Brandt jbrandt at bestpractical.com
Mon Apr 13 13:34:19 EDT 2020


The branch, 5.0/headers-in-alternative-email has been created
        at  1f9fdb66c1fbcc194f13235a926b6931c55ac20b (commit)

- Log -----------------------------------------------------------------
commit 1f9fdb66c1fbcc194f13235a926b6931c55ac20b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Apr 13 13:29:20 2020 -0400

    Clear Subject header from auto-generated text email part
    
    RT automatically generates a text alternative for HTML email
    when processing. Headers are optional in multipart email, but
    email agents should typically grab Subject only from the top
    level of the multipart email.
    
    Clear Subject if it gets included by default when the first
    email entity is copied.

diff --git a/lib/RT/Template.pm b/lib/RT/Template.pm
index d6abf86888..20c187d385 100644
--- a/lib/RT/Template.pm
+++ b/lib/RT/Template.pm
@@ -676,6 +676,16 @@ sub _DowngradeFromHTML {
     my $orig_entity = $self->MIMEObj;
 
     my $new_entity = $orig_entity->dup; # this will fail badly if we go away from InCore parsing
+
+    # We're going to make this multipart/alternative below, so clear out the Subject
+    # header copied from the original when we dup'd above.
+    # Alternative parts should have just formatting headers like Content-Type
+    # so maybe we should clear all, but staying conservative for now.
+
+    if ( $new_entity->head->get('Subject') ) {
+        $new_entity->head->delete('Subject');
+    }
+
     $new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
     $new_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list