/** * @test */ public function sendSetsHtmlBodyWithTextHtmlContentType() { $htmlMessage = '<h1>Very cool HTML message</h1>' . LF . '<p>Great to have HTML e-mails in oelib.</p>'; $sender = new Tx_Oelib_Tests_Unit_Fixtures_TestingMailRole('', '*****@*****.**'); $recipient = new Tx_Oelib_Tests_Unit_Fixtures_TestingMailRole('', $this->email['recipient']); $eMail = new Tx_Oelib_Mail(); $eMail->setSender($sender); $eMail->addRecipient($recipient); $eMail->setSubject($this->email['subject']); $eMail->setMessage('This is the plain text message.'); $eMail->setHTMLMessage($htmlMessage); $this->subject->send($eMail); $children = $this->subject->getFirstSentEmail()->getChildren(); /** @var Swift_Mime_MimeEntity $firstChild */ $firstChild = $children[0]; self::assertSame('text/html', $firstChild->getContentType()); }
/** * @test */ public function setHtmlMessageWithCssFileStoredStoresAttributesFromCssInHtmlMessage() { $this->subject->setCssFile(t3lib_extMgm::extPath('oelib') . 'Tests/Unit/Fixtures/test.css'); $this->subject->setHTMLMessage('<html>' . '<head><title>foo</title></head>' . '<body><h3>Bar</h3></body>' . '</html>'); self::assertSame('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"' . ' "http://www.w3.org/TR/REC-html40/loose.dtd">' . LF . '<html>' . LF . '<head><title>foo</title></head>' . LF . '<body><h3 style="font-weight: bold;">Bar</h3></body>' . LF . '</html>', $this->subject->getHTMLMessage()); }