带有MIME版本的PHP电子邮件标头:1.0

问题描述 投票:0回答:2

我有以下代码行:

        $from = "[email protected]";
        $headers = "From:" . $from;
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

我需要MIME类型,因为我正在使用html文件的file_get_contents,我的问题是在标题下显示为“ [email protected]:1.0”,我只想说“ [email protected] “如何从标题中显示的中取出MIME类型?

谢谢

php email header mime
2个回答
7
投票

只需在\r\n标头之后也添加From:

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

0
投票
$to = "[email protected]";
$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 protected]>\r\n"; 
$headers .= "Return-Path:New Agent Record <[email protected]>\r\n";
$headers .= "From: New Agent Record <[email protected]>\r\n";
$headers .= "Organization: New Agent Record\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";
© www.soinside.com 2019 - 2024. All rights reserved.