【问题标题】:php email headers with MIME-Version: 1.0带有 MIME 版本的 php 电子邮件标头:1.0
【发布时间】:2012-05-02 08:57:47
【问题描述】:

我有这几行代码:

        $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 类型中取出?

谢谢

【问题讨论】:

    标签: php email header mime


    【解决方案1】:

    只需在 From: 标头之后添加 \r\n 即可。

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

    【讨论】:

    • 真棒拉杜,我将无法再接受 10 分钟的回答
    【解决方案2】:
    $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";
    

    【讨论】:

    • 你的答案与已经给出的答案有什么不同......你也可以投票赞成
    猜你喜欢
    • 2011-04-03
    • 1970-01-01
    • 2014-07-19
    • 2013-04-18
    • 2012-02-18
    • 1970-01-01
    • 2017-08-22
    • 1970-01-01
    • 2011-05-31
    相关资源
    最近更新 更多