Horde_Mime_Part::getContents PHP Method

getContents() public method

Return the body of the part.
public getContents ( array $options = [] ) : mixed
$options array Additional options: - canonical: (boolean) Returns the contents in strict RFC 822 & 2045 output - namely, all newlines end with the canonical sequence. DEFAULT: No - stream: (boolean) Return the body as a stream resource. DEFAULT: No
return mixed The body text (string) of the part, null if there is no contents, and a stream resource if 'stream' is true.
    public function getContents($options = array())
    {
        return empty($options['canonical']) ? empty($options['stream']) ? $this->_readStream($this->_contents) : $this->_contents : $this->replaceEOL($this->_contents, self::RFC_EOL, !empty($options['stream']));
    }

Usage Example

Example #1
0
    public function testBug10431()
    {
        $text = 'Das könnte zum Beispiel so aussehen, dass wir bei entsprechenden Anfragen diese an eine Kontaktperson bei Euch weiterleiten. Oder Ihr schnürt ein entsprechendes Paket, dass wir in unseren Angeboten mit anführen. Bei erfolgreicher Vermittlung bekämen wir eine Vermittlungsgebühr.
Wir ständen dann weiterhin für 3rd-Level-Support zur Verfügung, d.h. für alle Anfragen des Kunden bzgl. Horde, die nicht zum Tagesgeschäft gehören.';
        $text = Horde_String::convertCharset($text, 'UTF-8', 'ISO-8859-1');
        $textBody = new Horde_Mime_Part();
        $textBody->setType('text/plain');
        $textBody->setCharset('ISO-8859-1');
        $flowed = new Horde_Text_Flowed($text, 'ISO-8859-1');
        $flowed->setDelSp(true);
        $textBody->setContents($flowed->toFlowed());
        $flowed_txt = $textBody->toString(array('headers' => false));
        $textBody2 = new Horde_Mime_Part();
        $textBody2->setType('text/plain');
        $textBody2->setCharset('ISO-8859-1');
        $textBody2->setContents($flowed_txt, array('encoding' => 'quoted-printable'));
        $flowed2 = new Horde_Text_Flowed($textBody2->getContents(), 'ISO-8859-1');
        $flowed2->setMaxLength(0);
        $flowed2->setDelSp(true);
        $this->assertEquals($text, trim($flowed2->toFixed()));
    }
All Usage Examples Of Horde_Mime_Part::getContents