public function itSetsFromAndReplyToHeaders() { $mail_enhancer = new MailEnhancer(); $mail = new Codendi_Mail(); $from_mail = '*****@*****.**'; $replyto_mail = '*****@*****.**'; $mail_enhancer->addHeader('From', $from_mail); $mail_enhancer->addHeader('Reply-To', $replyto_mail); $mail_enhancer->enhanceMail($mail); $this->assertEqual($mail->getFrom(), $from_mail); $mail_headers = $mail->getMail()->getHeaders(); $this->assertEqual($mail_headers['reply-to'][0], $replyto_mail); }
private function buildEmail(Project $project, Notification $notification, MailEnhancer $mail_enhancer, $email) { $mail = $this->getMailSender(); $mail->setFrom(ForgeConfig::get('sys_noreply')); $mail->setTo($email); if ($project->getTruncatedEmailsUsage()) { $presenter = new MailPresenter($notification->getServiceName(), $notification->getGotoLink(), ForgeConfig::get('sys_fullname')); $mail->setSubject($this->renderer->renderToString(self::TRUNCATED_SUBJECT_TEMPLATE, $presenter)); $mail->setBodyHtml($this->renderer->renderToString(self::TRUNCATED_BODY_TEMPLATE, $presenter)); } else { $mail_enhancer->enhanceMail($mail); if ($notification->hasHTMLBody()) { $mail->setBodyHtml($notification->getHTMLBody()); } if ($notification->hasTextBody()) { $mail->setBodyText($notification->getTextBody()); } $mail->setSubject($notification->getSubject()); } return $mail; }