/** * Establishes a connection with the MTA * * @return bool connected * @private */ protected function connect() { $this->socket = fopen('swift://esmtp', 'w+'); $processor = Swift_Stream_Processor::getInstance(); $processor->addObserver(new Swift_Stream_MailProxy($processor)); $this->readHook =& $this->socket; $this->writeHook =& $this->socket; if (!$this->socket) { return $this->connected = false; } else { return $this->connected = true; } }
/** * PHP's call back for fopen() actions on the fake stream */ public function stream_open($path, $mode, $options, &$opened_path) { $this->processor = Swift_Stream_Processor::getInstance(); $this->processor->isOpen = true; return $this->processor->isOpen; }