Re: Issues with Mail_mimedecode and mail templates
| From: | Justin Patrin | Date: | Tue, 11 Oct 2005 16:35:41 +0000 |
| Subject: | Re: Issues with Mail_mimedecode and mail templates | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21370@lists.php.net to get a copy of this message | ||
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