Commit deedcd61 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

don't reparse the template, just turn the HTML template

  into plaintext.
Don't declare the original mime object as multipart until
  we've dup'ed it or crazy things happen to the body of the
  mime pieces and we end up with very nested mails

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/3.8/trunk@16186 e417ac7c-1bcc-0310-8ffa-8f5827389a85
parent 00642366
......@@ -430,22 +430,14 @@ sub _DowngradeFromHTML {
my $self = shift;
my $orig_entity = $self->MIMEObj;
local $RT::Transaction::PreferredContentType = 'text/plain';
my ($rv, $msg) = $self->_Parse(@_);
if (!$rv) {
$self->{MIMEObj} = $orig_entity;
return;
}
my $new_entity = $orig_entity->dup; # this will fail badly if we go away from InCore parsing
$new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
$new_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
$orig_entity->head->mime_attr( "Content-Type" => 'text/html' );
$orig_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
$orig_entity->make_multipart('alternative', Force => 1);
my $new_entity = $self->{MIMEObj};
$new_entity->head->mime_attr( "Content-Type" => 'text/plain' );
$new_entity->head->mime_attr( "Content-Type.charset" => 'utf-8' );
require HTML::FormatText;
require HTML::TreeBuilder;
$new_entity->bodyhandle(MIME::Body::InCore->new(\(scalar(HTML::FormatText->new(
......@@ -458,7 +450,8 @@ sub _DowngradeFromHTML {
$orig_entity->add_part($new_entity, 0); # plain comes before html
$self->{MIMEObj} = $orig_entity;
return ($rv, $msg);
return;
}
=head2 CurrentUserHasQueueRight
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment