Пример #1
0
    public function testAddPart()
    {
        $message = <<<EOT
Date: Fri, 13 Feb 09 15:47:25 +0100
MIME-Version: 1.0
To: John Doe <*****@*****.**>
Content-Type: multipart/alternative; boundary="c67476988f320ca04d61815bcfd14360"

This is a multi-part message in MIME format.
--c67476988f320ca04d61815bcfd14360
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

test
--c67476988f320ca04d61815bcfd14360
Content-Type: text/calendar; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20090218T140000Z
DTEND:20090218T153000Z
DTSTAMP:20090217T160043Z
ORGANIZER:mailto:john@doe.net
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:test
END:VEVENT
END:VCALENDAR
--c67476988f320ca04d61815bcfd14360--
EOT;
        $mail = new Mail($this->date);
        $mail->addTo('*****@*****.**', 'John Doe');
        $mail->setText('test');
        $mail->addPart(fopen(__DIR__ . '/files/dummy.ics', 'r'), 'text/calendar', 'quoted-printable');
        $mail->setBoundary('c67476988f320ca04d61815bcfd14360');
        $this->assertEquals($message, (string) $mail);
    }