|
@@ 717-745 (lines=29) @@
|
| 714 |
|
} |
| 715 |
|
} |
| 716 |
|
} |
| 717 |
|
foreach($base->partIterator() as $part) |
| 718 |
|
{ |
| 719 |
|
if ($part->getPrimaryType()== 'text') |
| 720 |
|
{ |
| 721 |
|
$charset = $part->getContentTypeParameter('charset'); |
| 722 |
|
if ($charset && $charset != 'utf-8') |
| 723 |
|
{ |
| 724 |
|
$content = Translation::convert($part->toString(array( |
| 725 |
|
'encode' => Horde_Mime_Part::ENCODE_BINARY, // otherwise we cant recode charset |
| 726 |
|
)), $charset, 'utf-8'); |
| 727 |
|
$part->setContents($content, array( |
| 728 |
|
'encode' => Horde_Mime_Part::ENCODE_BINARY, // $content is NOT encoded |
| 729 |
|
)); |
| 730 |
|
$part->setContentTypeParameter('charset', 'utf-8'); |
| 731 |
|
if ($part === $base) |
| 732 |
|
{ |
| 733 |
|
$this->addHeader('Content-Type', $part->getType(true)); |
| 734 |
|
// need to set Transfer-Encoding used by base-part, it always seems to be "quoted-printable" |
| 735 |
|
$this->addHeader('Content-Transfer-Encoding', 'quoted-printable'); |
| 736 |
|
} |
| 737 |
|
$converted = true; |
| 738 |
|
} |
| 739 |
|
} |
| 740 |
|
elseif ($part->getType() == 'message/rfc822') |
| 741 |
|
{ |
| 742 |
|
$mailerWithIn = new Mailer('initbasic'); |
| 743 |
|
$part->setContents($mailerWithIn->convertMessageTextParts($part->toString(), $stream, $charset, $converted)); |
| 744 |
|
} |
| 745 |
|
} |
| 746 |
|
if ($converted) |
| 747 |
|
{ |
| 748 |
|
$this->setBasePart($base); |
|
@@ 769-796 (lines=28) @@
|
| 766 |
|
$mailer = new Mailer(false); // false = no default headers and mail account |
| 767 |
|
$mailer->addHeaders(Horde_Mime_Headers::parseHeaders($message)); |
| 768 |
|
$base = Horde_Mime_Part::parseMessage($message); |
| 769 |
|
foreach($base->partIterator() as $part) |
| 770 |
|
{ |
| 771 |
|
if ($part->getPrimaryType()== 'text') |
| 772 |
|
{ |
| 773 |
|
$charset = $part->getContentTypeParameter('charset'); |
| 774 |
|
if ($charset && $charset != 'utf-8') |
| 775 |
|
{ |
| 776 |
|
$content = Translation::convert($part->toString(array( |
| 777 |
|
'encode' => Horde_Mime_Part::ENCODE_BINARY, // otherwise we cant recode charset |
| 778 |
|
)), $charset, 'utf-8'); |
| 779 |
|
$part->setContents($content, array( |
| 780 |
|
'encode' => Horde_Mime_Part::ENCODE_BINARY, // $content is NOT encoded |
| 781 |
|
)); |
| 782 |
|
$part->setContentTypeParameter('charset', 'utf-8'); |
| 783 |
|
if ($part === $base) |
| 784 |
|
{ |
| 785 |
|
$mailer->addHeader('Content-Type', $part->getType(true)); |
| 786 |
|
// need to set Transfer-Encoding used by base-part, it always seems to be "quoted-printable" |
| 787 |
|
$mailer->addHeader('Content-Transfer-Encoding', 'quoted-printable'); |
| 788 |
|
} |
| 789 |
|
$converted = true; |
| 790 |
|
} |
| 791 |
|
} |
| 792 |
|
elseif ($part->getType() == 'message/rfc822') |
| 793 |
|
{ |
| 794 |
|
$part->setContents(self::convert($part->toString(), $stream, $charset, $converted)); |
| 795 |
|
} |
| 796 |
|
} |
| 797 |
|
if ($converted) |
| 798 |
|
{ |
| 799 |
|
$mailer->setBasePart($base); |