PHP mail()电子邮件地址与发送的电子邮件不同

时间:2011-09-16 00:19:25

标签: php email sendmail send

  

可能重复:
  Emails showing from host.myserver.com instead of mydomain.com

不确定这是否有意义,但当我尝试从russell.harrower@mydomain.com发送电子邮件时,它说发送来自root@host.mydomain.com

有没有解决这个问题?

Yahoo Results。

From iNcard Thu Sep 15 20:25:29 2011
X-Apparently-To: russell.harrower@yahoo.com via 98.138.87.158; Thu, 15 Sep 2011 20:25:32 -0700
Return-Path: <icard-lifestyle-guide@incard.com.au>
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 <icard-lifestyle-guide@incard.com.au>)
    id 1R4P3R-0006qu-DD
    for russell.harrower@yahoo.com; Thu, 15 Sep 2011 22:25:29 -0500
To: russell.harrower@yahoo.com
Subject: iNcard Eftpos Lifestyle Guide
X-PHP-Script: realcashback.com.au/system/classes/core.php for 61.88.97.122
From: iNcard <russell.harrower@incard.com.au>
Reply-To: iNcard <russell.harrower@incard.com.au>
Message-ID:< icard-lifestyle-guide@incard.com.au>
X-Mailer: PHP v5.2.17
MIME-Version: 1.0
Content-Type: text/html; boundary="75434adf143cb37a87b1e10e2f08ffd4"
Sender:  <realcas@host.realcashback.com.au>
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

3 个答案:

答案 0 :(得分:4)

我假设你正在使用mail()功能。您需要设置From:标题。

取自文件:

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n";

mail($to, $subject, $message, $headers);

这表示电子邮件是从您webmaster@exmaple.com发送的,您使用的$headers行是:

$headers = 'From: russell.harrower@mydomain.com' . "\r\n";

答案 1 :(得分:1)

取决于您使用的是Windows还是unix。

Windows,使用php.ini中的(命名错误的)sendmail_from条目

Unix依赖于你的MTA ...通常它涉及在php.ini中再次在sendmail_path中设置正确的标志 但是有些MTA会允许你使用putenv()变量导致“sendmail”MUA注入使用你的自定义SMTP信封发送者。

编辑 - 附加:

好的,所以你的MTA是exim,答案取决于你的exim配置。您需要告诉exim允许PHP设置信封发件人地址(-f notroot@someone.com)。阅读:http://www.exim.org/exim-html-3.20/doc/html/spec_5.html#SEC38

答案 2 :(得分:0)

尝试发送这样的邮件,看看它是否适合您:

<?php
mail($to, $subject, $body, $headers, "-fyou@yourdomain.com");
?>

你在$ header中也有“From:you@yourdomain.com”吗?