来自变量的电子邮件无法正常工作

时间:2015-11-27 10:29:40

标签: php

我正在尝试发送电子邮件但是当它出现在我的收件箱中时,我提到的电子邮件虽然来自邮件服务器但没有显示。为什么会这样呢?

//This one is working fine 
if($email) {
        $from     = "EditMate@editmate.co";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= "From:" . $from;

        echo mail($email, $subject, $message_admin, $headers);
    }

    //In this one it is not showing the from email 
    if($receipt) {
        $from     = "newproject@editmate.co";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= "From:" . $from;

        echo mail($receipt, $subject, $message_admin, $headers);
    }

1 个答案:

答案 0 :(得分:1)

尝试在mail()函数的$ additional_parameters部分中添加地址,例如:

mail($receipt, $subject, $message_admin, $headers,"-f newproject@editmate.co");