电子邮件显示来自 host.myserver.com 而不是 mydomain.com

电子邮件显示来自 host.myserver.com 而不是 mydomain.com

包括来自雅虎消息的标题结果。您将看到其中是否有 server.realcashback.com.au,但我需要它不是来自我的服务器,有没有办法让它以我的 domain.com 而不是服务器的形式发送。我希望它从哪个域发送不在同一台服务器上。

我正在使用 PHP

    From iNcard Thu Sep 15 20:25:29 2011
X-Apparently-To: [email protected] via 98.138.87.158; Thu, 15 Sep 2011 20:25:32 -0700
Return-Path: <[email protected]>
Received-SPF: none (domain of incard.com.au does not designate permitted sender hosts)
X-YMailISG: lo3RhWoWLDv_WHz3JN9HmYtpybG2PDVs8qfPdALeMm06q6Va
 7_JLFvrtF3ZMrNnWTt.LFkzfH8epmIbIXDqmvgfBfiEV5bgtYB.7u4Ct17Dx
 gXTX0gNkH7_Ad9Im0fuFYp6bB1b8N4ymRJ86dFjEsCaEEwB7Q8_5cZzMZJW9
 gZcRui_aVjfybJxiClzRlb8xgCsOsf1qYjJx5dF__GX9UcZqIhC9XOQgj8bf
 VEQKZMSuXGT8TAblfeAE0V39fQEPOOjBEMzYYMf7Mch8jjD.RlV4IOBVPZBF
 jNAthv0bCKIQICb7JBEVe03A9C33MzIYyY_DlGugFBdr9I3r19PZKutv2Lsd
 e7FkpZ6li8rd3Em5wN3blqWGP.pgtxnOAw4klakMQbxQ9MuRPcvLoVT_G1Ab
 .eLzBJnHwojtG3.nsCahq1mxq88GsG9ZeAqaN74Fn1Cs8zGKx2dIndp_8lPt
 CH_M4q5DXvjpQmCszDbICAKXJFX9VaQFsjjOMUVwJemDlGlSm.N0xUb78MX7
 WFXZyht5tGLsuJcNR8qazP1DoHPt0Z4yKNE.SGOpCdV.aqyWaU3Z84rFodob
 aR0ZfXg411De2TyOw3G1d4OPIST_fNgVHslC1gaeGQc5jRQur37E.5J4cuYl
 PTKhZKh2WKjTACJaLauMzurW3da7f_46iurJLNm_kUfCbNUwjTjfcjfm7zcC
 CFYlgMQ.uwIyFEZ9wfTFMKhdktB1Pt6_OJZ2AMDgfVbkWsGhzSPpzGBW8wIN
 ObOPKdwaDDBgGHeBR2om9uTq1nL.O3KvX946mgYMhbcBdDQAXyiW.9I2882M
 6a.0YjE12tfEzrmYAWCijJQw7uOlfuDYsBO2FOEYRzfgvnHB5hoTHJb3NHz5
 3sIXnnIfAB6sbh7psVd9Hp.nE6bmaqQr4CubIWJanYv6.o5sxKBXVQEuHFTA
 3s0AAP3FlW8Qpsj_i2SybgmHBvFx_.a0sM2Qh6p3d0D7zQZLIwzYS0nA6wRL
 GtM_krFeie2fRApV7s.GIxyn2vauuypWFzF.vKRaxLLfsYnLljcOYy9EXeQC
 ahCxNHg9lppRMZNvPyTFBpcj1mle32pZkWE5HQyxr_aNnz3a69RPoBnQNvi3
 W4zl_CsWcBxqxSdA15i2Kkh0HDgO6THcfq1Vwaf89buHwqFo2RnRcumB1Q7W
 vRxBG9ci..an6iKSaPIGEvTOkwIhBbn17sL62hliHa6kVnnv5iIGdiPHZYxb
 BQh3oDtYkL8i.ICgkpQW4OCXj007fmizFgQvO1f1DYxAkbCbztbIHzzAv5Ae
 kQmxBYTDfOMUmfbU996gPH25NYiVuF1z_eY6CB0BFozwv7gnadJBfGhzi6H2
 XndEqKkhYXmSQ1.ixvAn78xYt8eJwi0C3Y0CRt5qbM84S0M0dbI-
X-Originating-IP: [173.199.158.72]
Authentication-Results: mta1011.mail.ac4.yahoo.com  from=host.realcashback.com.au; domainkeys=neutral (no sig);  from=incard.com.au; dkim=neutral (no sig)
Received: from 127.0.0.1  (EHLO host.realcashback.com.au) (173.199.158.72)
  by mta1011.mail.ac4.yahoo.com with SMTP; Thu, 15 Sep 2011 20:25:32 -0700
Received: from realcas by host.realcashback.com.au with local (Exim 4.69)
    (envelope-from <[email protected]>)
    id 1R4P3R-0006qu-DD
    for [email protected]; Thu, 15 Sep 2011 22:25:29 -0500
To: [email protected]
Subject: iNcard Eftpos Lifestyle Guide
X-PHP-Script: realcashback.com.au/system/classes/core.php for 61.88.97.122
From: iNcard <[email protected]>
Reply-To: iNcard <[email protected]>
Message-ID:< [email protected]>
X-Mailer: PHP v5.2.17
MIME-Version: 1.0
Content-Type: text/html; boundary="75434adf143cb37a87b1e10e2f08ffd4"
Sender:  <[email protected]>
Date: Thu, 15 Sep 2011 22:25:29 -0500
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.realcashback.com.au
X-AntiAbuse: Original Domain - yahoo.com
X-AntiAbuse: Originator/Caller UID/GID - [500 32002] / [47 12]
X-AntiAbuse: Sender Address Domain - incard.com.au
X-Source: /usr/bin/php
X-Source-Args: /usr/bin/php /home/realcas/public_html/system/classes/core.php 
X-Source-Dir: realcashback.com.au:/public_html/system/classes
Content-Length: 8054

PHP 代码

public function sendemail($name, $whichemail, $emailaddress, $sender)
    {
        $this->whichemail = $whichemail;




        $getemail = mysql_query("SELECT * FROM sendemails WHERE id = '".$this->whichemail."'");

        $row = mysql_fetch_array($getemail);

//      print $row["typeid"];
        if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { 
          $eol="\r\n"; 
        } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { 
          $eol="\r"; 
        } else { 
          $eol="\n"; 
        }
        $headers .= 'From: iNcard <'.$sender.'>'.$eol; 
        $headers .= 'Reply-To: iNcard <'.$sender.'>'.$eol; 
        $headers .= 'Return-Path: iNcard <'.$sender.'>'.$eol;     // these two to set reply address 
        $headers .= "Message-ID:<".$now." [email protected]>".$eol; 
        $headers .= "X-Mailer: PHP v".phpversion().$eol;           // These two to help avoid spam-filters 
        # Boundry for marking the split & Multitype Headers 
        $mime_boundary=md5(time()); 
        $headers .= 'MIME-Version: 1.0'.$eol; 
        $headers .= "Content-Type: text/html; boundary=\"".$mime_boundary."\"".$eol; 

        $body = $row["html"];

        $correct = array($name, $emailaddress, $sender, "{$this->whichemail}");
        $wrong   = array("[name]","[sendTo]", "[sendFrom]", "[whatemail]");

        $newbody = str_replace($wrong, $correct, $body);

        mail($emailaddress, $row["subject"], $newbody, $headers,"[email protected]");
    }

答案1

如果 From: 标头与邮件发件人的理解不符,某些邮件服务器会添加 Sender: 标头。如果您可以控制站点的 Exim 配置,我相信您应该能够关闭此行为。

如果您也不想在“已接收:”标题中显示,那么您发送电子邮件的方式很可能会发生较大变化。一种可能性是将消息发送外包给第三方;根据您想要这样做的原因,这可能也不可接受。

顺便说一句,尝试设置 Return-Path 是没有意义的,因为它将在接收端设置为您的信封发件人。也许还有一种方法可以从 PHP 设置信封发件人(在这种情况下,我猜您的 Sender: 问题也会消失)。

答案2

哦,也许我知道问题是什么,发件人地址(incard.com.au)的域名与发送服务器的名称不匹配(host.realcashback.com.au)

如果您尝试发送的电子邮件地址与服务器名称不匹配,您的电子邮件很可能会被标记为垃圾邮件,并且某些客户端将显示该电子邮件实际上不是来自名为 (incard.com.au) 的服务器,而您的情况下确实如此。

如果您拥有 incard.com.au,那么您需要更改您的名称服务器,将所有(或至少邮件)流量指向 (host.realcashback.com.au) 所在的 IP 地址

如果您已经完成此操作,则需要更改 php.ini 中的邮件设置以匹配 incard.com.au 地址

SMTP = incard.com.au
sendmail_from = [email protected]

相关内容