How can I get mail source (headers, body, boundary - all together as a plain text) using Zend_Mail (POP3).
It returns parsed parts by default, I need the raw message source.
How can I get mail source (headers, body, boundary - all together as a plain text) using Zend_Mail (POP3).
It returns parsed parts by default, I need the raw message source.
There's no such method in Zend Mail.
But you may look at the class sources and see how to send a direct command to the mail server to get the message source.
Maybe you could use the getRawHeader()
and getRawContent()
methods of the Zend_Mail_Storage_Pop3
class. Would it be enough for your purpose?
Some API docs (I didn't find them in the Reference Guide):
If you have a Zend_Mail instance, you can get the decoded content:
/** @var $message Zend_Mail */
echo $message->getBodyText()->getRawContent();
I made my own layer for that:
/**
* Transport mail layer for retrieve content of message
*
* @author Petr Kovar
*/
class My_Mailing_Transport extends Zend_Mail_Transport_Abstract{
protected $_messageContent;
/**
* Only assign message to some variable
*/
protected function _sendMail(){
$this->_messageContent = $this->header . Zend_Mime::LINEEND . $this->body;
}
/**
* Get source code of message
*
* @return string
*/
public function getMessageContent(){
return $this->_messageContent;
}
}
And than only call that:
$transport = new My_Mailing_Transport();
$transport->send($mail);
return $transport->getMessageContent();
© 2022 - 2024 — McMap. All rights reserved.