public function getMessage() { $message = new Message(); $message->addTo('*****@*****.**', 'ZF DevTeam')->addCc('*****@*****.**')->addBcc('*****@*****.**', 'CR-Team, ZF Project')->addFrom(array('*****@*****.**', 'Matthew' => '*****@*****.**'))->setSender('*****@*****.**', 'Ralph Schindler')->setSubject('Testing Zend\\Mail\\Transport\\Sendmail')->setBody('This is only a test.'); $message->headers()->addHeaders(array('X-Foo-Bar' => 'Matthew')); return $message; }
/** * Prepare header string from message * * @param Message $message * @return string */ protected function prepareHeaders(Message $message) { $headers = new Headers(); foreach ($message->headers() as $header) { if ('Bcc' == $header->getFieldName()) { continue; } $headers->addHeader($header); } return $headers->toString(); }
/** * Prepare the textual representation of headers * * @param Message $message * @return string */ protected function prepareHeaders(Message $message) { $headers = $message->headers(); // On Windows, simply return verbatim if ($this->isWindowsOs()) { return $headers->toString(); } // On *nix platforms, strip the "to" header $headersToSend = new Headers(); foreach ($headers as $header) { if ('To' == $header->getFieldName()) { continue; } $headersToSend->addHeader($header); } return $headersToSend->toString(); }