I don't understand how to parse raw email with ZF2?
In ZF1 it was:
$emailObj = new Zend_Mail_Message(array('raw' => $str_email));
And it was ok for me!
Now it should be:
$emailObj = Zend\Mail\Message::fromString($str_email);
or
$emailObj = new Zend\Mail\Storage\Message(array ('raw' => $str_email));
or maybe:
$emailObj = Zend\Mime\Message::createFromMessage($str_email, $boundary);
But nothing of these does not work for me!
I'm currently using ZF 2.5 via Composer. When I do
$emailObj = Zend\Mail\Message::fromString($str_email);
It works perfectly for me. This is my working code.
// Create a Zend\Mail\Message object with our message
$email = \Zend\Mail\Message::fromString($src);
// Create our transport
$transport = new \Zend\Mail\Transport\Smtp();
$options = new \Zend\Mail\Transport\SmtpOptions(array(
'host' => $this->_opts['smtp_server'],
));
$transport->setOptions($options);
$transport->send($email);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With