Re: Issues with Mail_mimedecode and mail templates

From: Date: Wed, 12 Oct 2005 04:27:41 +0000
Subject: Re: Issues with Mail_mimedecode and mail templates
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21377@lists.php.net to get a copy of this message
Ok thanks for your help Justin, your code worked, ill have to convert the lines somehow, also there has been changes in mimeDecode this is the version that works now, not the send array version $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true;
						$params['crlf']           = "\r\n";
$decoder = new Mail_mimeDecode($mailtext); $this->email_template = $decoder->decode($params); On 12/10/2005, at 2:35 AM, Justin Patrin wrote:
On 10/11/05, Dan Rossi <pear@electroteque.org> wrote:
Hi there, for some strange reason the _splitBodyHeader is not parsing my template properly therefore nothing is being returned here is an example template that used to work, yes used to work without having to add recipitents as i add these after From: Sender: To: Subject: The subject Hello , the email body even adding information here, its still not coming up properly, i has some crazy preg match for carriage returns and new lines however i code on osx.
Look at the line endings in your files. Are they set to mac newlines? (\r) If so, try switching to Unix newlines (\n) (damn Macs, they should be using unix newlines by default now). If this fixes the problem let the Mail_mime people know.
if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) {
             return array($match[1], $match[2]);
}
Yep, looks like this matches Windows or Unix newlines, but not Mac newlines. I suggest sticking to unix newlines in your source files. If you don't it makes it very hard to deal with them on any other machine. Try this regex, it *should* catch all 3 types of newlines. if (preg_match('/^(.*?)(?:\r\n|\r|\n){2}(.*)/s', $input, $match)) {
             return array($match[1], $match[2]);
} -- Justin Patrin -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.general (#21377) next »