Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MIME版本为1.0的php电子邮件标题_Php_Email_Header_Mime - Fatal编程技术网

MIME版本为1.0的php电子邮件标题

MIME版本为1.0的php电子邮件标题,php,email,header,mime,Php,Email,Header,Mime,我有以下几行代码: $from = "email@domian.com"; $headers = "From:" . $from; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 我需要MIME类型,因为我正在为html文件使用file\u get\u内容,我的问题是它显示为ema

我有以下几行代码:

        $from = "email@domian.com";
        $headers = "From:" . $from;
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
我需要MIME类型,因为我正在为html文件使用file\u get\u内容,我的问题是它显示为email@domain.comMIME-版本:1.0,我只想说email@domain.com如何将中的MIME类型从标题中显示出来

谢谢

只需在From:标题后添加\r\n即可

$headers = "From:" . $from . "\r\n";

太棒了,拉杜,再过10分钟我就无法接受你的答案了。你的答案和之前给出的有什么不同吗。。。你也可以投票赞成
$to = "whereyousendmail@gmail.com";
$from = "email@domian.com";
$subject = "New Agent Record";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "Reply-To: New Agent Record <email@domian.com>\r\n"; 
$headers .= "Return-Path:New Agent Record <email@domian.com>\r\n";
$headers .= "From: New Agent Record <email@domian.com>\r\n";
$headers .= "Organization: Your Email Subject\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";