php邮件标题中的哪个换行符, 或 ?

Which line break in php mail header, or ?(php邮件标题中的哪个换行符,或?)
本文介绍了php邮件标题中的哪个换行符, 或 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过很多使用 php 邮件功能的例子.其中一些使用 作为标题的换行符,一些使用 .

I've seen a lot of examples using the php mail function. Some of them use as line break for the header, some use .

$headers = "From: Just Me
"; 
$headers .= "Reply-To:  Just me <$email>
"; 

$headers = "From: Just Me
";
$headers .= "Reply-To:  Just me <$email>
";

哪一个是正确的?

有时我遇到使用 并且某些邮件客户端将部分标头解释为邮件文本(丢失这些标头信息)的情况 - 这是因为 是错误的吗?

Sometimes I've had cases where is used and part of the header is interpreted by some email clients as mail text (losing these header information) - is this because is wrong?

推荐答案

CRLF ,应该按照php 文档.此外,为了符合 RFC 2822 规范行必须由回车符分隔,CR 立即 后跟换行符,LF .

The CRLF , should be used according to the php documentation. Also, to conform to the RFC 2822 spec lines must be delimited by the carriage return character, CR immediately followed by the line feed, LF .

由于 是 Windows 平台原生的,而 是 Unix 平台原生的,因此您可以使用 PHP_EOL­Docs Windows 上的常量,它是脚本当前运行平台的适当换行符.

Since is native to Windows platforms and to Unix, you can use the PHP_EOL­Docs constant on Windows, which is the appropriate new line character for the platform the script is currently running on.

这篇关于php邮件标题中的哪个换行符, 或 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)
3