Wednesday, September 9

Literal... Interpreted... Quotes Matter

Something I never before (but probably should have) read that took hours to figure out:

If the string is enclosed in double-quotes ("), PHP will interpret more escape sequences for special characters. -via php.net
This really matters!!

For example. When you are sending mail, new lines are usually \r\n. If you have your message body in single quotes (') the \r\n will show up in the message!

Even more importantly. When using Pear mime, you have to define eol. Just remember $crlf = '\r\n' WILL NOT WORK!!! it has to be $crlf = "\r\n" If I had read to the bottom of the user comments on the pear page, it would have saved me a lot of time.

And yes, this post is actually about doing Mail_Mime with Pear :D

Resources:
PEAR Mail_Mime
PHP Maniac Examples

No comments: