stream = array_key_exists('stream', $options) ? $options['stream'] : fopen(STDERR); } function sendMessages(array $email_messages) { if (!$email_messages) return; $this->lock(); try { $this->stream_created = $this->open(); foreach ($email_messages as $msg) { fwrite($this->stream, sprintf("%s\n", $msg->getMessage()->asString())); fwrite($this->stream, str_repeat('-', 79)); fwrite($this->stream, "\n"); fflush($this->stream); } if ($this->stream_created) $this->close(); $this->unlock(); } catch (\Exception $e) { if ($this->stream_created) $this->close(); $this->unlock(); if (!$this->fail_silently) throw $e; } return count($email_messages); } function lock() {} function unlock() {} }