开发者

Why does the rmail-php-class fail if I setText(), but works if I only setHtml()?

开发者 https://www.devze.com 2023-01-01 02:23 出处:网络
I use this class for sending e-mail: http://www.phpguru.org/downloads/Rmail/Rmail%20for%20PHP/docs.html

I use this class for sending e-mail: http://www.phpguru.org/downloads/Rmail/Rmail%20for%20PHP/docs.html

It was work开发者_如何学Cing until I switched from "mail" to SMTP. Now, if I use setHtml($html) it works, but if I also use setText($text), it doesn't work.

Can it be that $text contains some invalid characters? Why would those characters work when using the system "mail", but not work on SMTP running on localhost?


It turns out "\n" characters (LF) are not allowed, only "\r\n" (CRLF) is acceptable in the e-mail text body.

Somehow among all the CRLF pairs one LF sneaked in, which caused the sending to fail.

Aren't bytes wonderful?

0

精彩评论

暂无评论...
验证码 换一张
取 消