File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,22 @@ public static function createNew()
9797 */
9898 public static function createFromString ($ raw )
9999 {
100- $ message = new self (['root ' => true , 'raw ' => $ raw ]);
100+ // do our own header-body splitting.
101+ //
102+ // \Zend\Mail\Storage\Message is unable to process mails that contain \n\n in text body
103+ // because it has heuristic which headers separator to use
104+ // and that gets out of control
105+ // https://github.com/zendframework/zend-mail/pull/159
106+
107+ // use rfc compliant "\r\n" EOL
108+ try {
109+ Mime \Decode::splitMessage ($ raw , $ headers , $ content , "\r\n" );
110+ } catch (Mail \Exception \RuntimeException $ e ) {
111+ // retry with heuristic
112+ Mime \Decode::splitMessage ($ raw , $ headers , $ content );
113+ }
114+
115+ $ message = new self (['root ' => true , 'headers ' => $ headers , 'content ' => $ content ]);
101116
102117 return $ message ;
103118 }
You can’t perform that action at this time.
0 commit comments