/** * * Sends a mail with a certain subject and bodytext to a recipient in form of a * frontend user. * * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $recipient * The recipient of the mail. This is a plain * frontend user. * @param string $subject The mail's subject * @param string $bodyText The mail's bodytext * * @return void * */ public function sendMail(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $recipient, $subject, $bodyText) { if ($recipient->getEmail()) { $mail = new \TYPO3\CMS\Core\Mail\MailMessage(); $mail->setTo(array($recipient->getEmail()))->setFrom($this->getDefaultSenderAddress(), $this->getDefaultSenderName())->setSubject($subject)->setBody($bodyText)->send(); } }
/** * Sends a mail with a certain subject and bodytext to a recipient in form of a frontend user. * * @param FrontendUser $recipient The recipient of the mail. This is a plain frontend user. * @param string $subject The mail's subject * @param string $bodyText The mail's bodytext * @return void */ public function sendMail(FrontendUser $recipient, $subject, $bodyText) { $typo3Mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage'); $typo3Mail->setFrom([$this->getDefaultSenderAddress() => $this->getDefaultSenderName()])->setTo($recipient->getEmail())->setSubject($subject)->setBody($bodyText, 'text/html')->send(); }
/** * @test */ public function setEmailSetsEmail() { $email = '*****@*****.**'; $this->fixture->setEmail($email); $this->assertSame($email, $this->fixture->getEmail()); }