0

我有这些代码行:

        $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 类型,因为我将 file_get_contents 用于 html 文件,我的问题在于它显示为“email@domain.comMIME-Version:1.0”的标题下,我希望它只是说“email@domain.com”如何如何从标题中显示的 MIME 类型中取出?

谢谢

4

2 回答 2

7

只需\r\nFrom:标题后添加即可。

$headers = "From:" . $from . "\r\n";
于 2012-04-20T18:53:16.110 回答
0
$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";
于 2020-01-03T06:37:10.847 回答