- my ($simple, $part) = @_;
- $simple->header_set("Content-Type", $part->content_type);
- $simple->body_set($part->body_raw);
- mark_changed($simple);
+ my ($mime, $part) = @_;
+ $mime->header_set('Content-Type', $part->content_type);
+ $mime->body_set($part->body_raw);
+ my $cte = $part->header('Content-Transfer-Encoding');
+ if (defined($cte) && $cte ne '') {
+ $mime->header_set('Content-Transfer-Encoding', $cte);
+ }
+ mark_changed($mime);