/** * Sends the mail out using the php mail() function. * * @return boolean whether the mail function accepted the inputs. */ public function send() { // Create the Transport if (!self::$transport instanceof Swift_Transport) { self::$transport = Swift_MailTransport::newInstance(); } $mailer = Swift_Mailer::newInstance(self::$transport); $this->message = Swift_Message::newInstance()->setSubject($this->subject)->setFrom($this->from)->setTo($this->to)->setBody($this->body)->addPart('<p>' . $this->body . '</p>', 'text/html'); if ($this->reply_to) { $this->message->setReplyTo($this->reply_to); $this->message->setSender($this->from); // Have to set sender when there's a different reply-to. } if (defined('DEBUG') && DEBUG) { error_log($this->message . PHP_EOL, 3, LOGS . "emails.log"); } // Send the message along. return (bool) $mailer->send($this->message); }
<?php // Test-suite bootstrap require_once realpath(__DIR__) . '/../resources.php'; require_once CORE . 'base.inc.php'; require_once ROOT . 'tests/TestAccountCreateAndDestroy.php'; require_once ROOT . 'tests/NWTest.php'; //use NinjaWars\tests\TestAccountCreateAndDestroy; $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; Nmail::$transport = Swift_NullTransport::newInstance();