Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend\Mail\Storage\Message Mime Error #3937

Closed
diemuzi opened this issue Mar 2, 2013 · 2 comments
Closed

Zend\Mail\Storage\Message Mime Error #3937

diemuzi opened this issue Mar 2, 2013 · 2 comments

Comments

@diemuzi
Copy link
Contributor

diemuzi commented Mar 2, 2013

The purpose of this is for a Mailing List. Basically if the Mailing List is set to be moderated than the email is saved to a file instead of being sent to the recipient list. Once the email has been approved then a command is sent to the server to have this email sent. So the script example reads the file and sends it.

I've created a Gist which includes a test and several examples to try:
https://gist.github.com/diemuzi/5073563

In the gist you'll find:
test.php
working_text.txt
working_mime.txt
notworking_mime.txt

The emails were saved using http://zf2.readthedocs.org/en/latest/modules/zend.mail.file.options.html

A brief explanation of these files:

working_text.txt - is a text email only, it contains no images. This works as expected with the test.php file and the email is read from file and sent to the recipient.

working_mime.txt - This is the same file as notworking_mime.txt except I manually edited it and only removed This is a message in Mime Format. If you see this, your mail reader does not support this format. and then resaved the message. Once this line is removed, the message is sent as expected.

notworking_mime.txt - This contains text and a single (clean) image. This does not work when attempting to be read. When trying to open and read this file the following is sent to the error log:

"does not match header format!' in /usr/local/apache/vhosts/otwebsoft_worker/vendor/Zend/Mail/Headers.php:87ption' with message 'Line "This is a message in Mime Format.  If you see this, your mail reader does not support this format.
Stack trace:
#0 /usr/local/apache/vhosts/otwebsoft_worker/vendor/Zend/Mime/Decode.php(141): Zend\Mail\Headers::fromString('Date: Fri, 01 M...', '?')
#1 /usr/local/apache/vhosts/otwebsoft_worker/vendor/Zend/Mail/Storage/Part.php(99): Zend\Mime\Decode::splitMessage('Date: Fri, 01 M...', 'Date: Fri, 01 M...', '??--=_e8be6ee00...', '?', false)
#2 /usr/local/apache/vhosts/otwebsoft_worker/vendor/Zend/Mail/Storage/Message.php(52): Zend\Mail\Storage\Part->__construct(Array)
#3 /usr/local/apache/vhosts/otwebsoft_worker/scripts/test.php(16): Zend\Mail\Storage\Message->__construct(Array)
#4 {main}
  thrown in /usr/local/apache/vhosts/otwebsoft_worker/vendor/Zend/Mail/Headers.php on line 87
@MartijnHols
Copy link

This seems to fix this:

$test = file_get_contents('D:/data/mail/BrokenMail.eml'); // no difference with txt except that eml is openable with Outlook
$test = preg_replace('~\R~u', "\r\n", $test); // replace "\n" and "\r" with "\r\n"
$mail = Zend\Mail\Message::fromString($test);

@GeeH
Copy link

GeeH commented Jun 27, 2016

This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html

@GeeH GeeH closed this as completed Jun 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants