/** * Sets the newsletter * * @param Newsletter $newsletter * @param string $language * @throws Exception */ public function setNewsletter(Newsletter $newsletter, $language = null) { // When sending newsletter via scheduler (so via CLI mode) realurl cannot guess // the domain name by himself, so we help him by filling HTTP_HOST variable $_SERVER['HTTP_HOST'] = $newsletter->getDomain(); $_SERVER['SCRIPT_NAME'] = '/index.php'; $this->siteUrl = $newsletter->getBaseUrl() . '/'; $this->linksCache = array(); $this->newsletter = $newsletter; $this->homeUrl = $this->siteUrl . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('newsletter'); $this->senderName = $newsletter->getSenderName(); $this->senderEmail = $newsletter->getSenderEmail(); $this->replytoName = $newsletter->getReplytoName(); $this->replytoEmail = $newsletter->getReplytoEmail(); $bounceAccount = $newsletter->getBounceAccount(); $this->bounceAddress = $bounceAccount ? $bounceAccount->getEmail() : ''; // Build html $validatedContent = $newsletter->getValidatedContent($language); if (count($validatedContent['errors'])) { throw new Exception('The newsletter HTML content does not validate. The sending is aborted. See errors: ' . serialize($validatedContent['errors'])); } $this->setHtml($validatedContent['content']); // Build title from HTML source (we cannot use $newsletter->getTitle(), because it is NOT localized) $this->setTitle($validatedContent['content']); // Attaching files $files = $newsletter->getAttachments(); foreach ($files as $file) { if (trim($file) != '') { $filename = PATH_site . "uploads/tx_newsletter/{$file}"; $this->attachments[] = Swift_Attachment::fromPath($filename); } } }
/** * @test */ public function getReplytoEmail() { $this->assertSame('*****@*****.**', $this->subject->getReplytoEmail(), 'sould return globally configured default value'); $this->subject->setReplytoEmail('*****@*****.**'); $this->assertSame('*****@*****.**', $this->subject->getReplytoEmail(), 'sould return locally set value'); }