2012-10-31 36 views
2

使用CI's email library,我有以下的代碼,將PW用戶:Gmail使用原來的「TO」地址,而不是「發件人」地址回覆

$email_html_message   = '<html><body>'. 
             'Your password is '.$password.'<br>'. 
             '<a href="'. base_url().'">Login to MySite</a>'. 
             '</body></html>'; 


     $config['charset'] = 'iso-8859-1'; 
     $config['mailtype'] = 'html'; 
     $this->email->initialize($config); 

     $this->email->from('[email protected]', 'MySite Admin'); 
     $this->email->to($user_email); 
     $this->email->subject('Your MySite Login'); 
     $this->email->message($email_html_message); 
     $this->email->send(); 

我測試此代碼的兩個帳戶:Gmail的和我的ISP的smtp電子郵件帳戶。

兩個測試發送的電子郵件,但這裏的問題:

如果我點擊通過Gmail的答覆,爲解決此回覆的電子郵件被髮送到以下地址:

enter image description here

當我點擊通過Windows Mail回覆時(例如我的smtp帳戶),這不會發生。

這裏是「原始信息」來自Gmail的標題:

Delivered-To: [email protected] 
Received: by 10.114.17.8 with SMTP id k8csp412473ldd; 
     Wed, 31 Oct 2012 07:27:06 -0700 (PDT) 
Received: by 10.220.142.79 with SMTP id p15mr18061226vcu.71.1351693626443; 
     Wed, 31 Oct 2012 07:27:06 -0700 (PDT) 
Return-Path: <[email protected]> 
Received: from mailout12.yourhostingaccount.com (mailout12.yourhostingaccount.com. [65.254.253.98]) 
     by mx.google.com with ESMTP id p5si2963631vcv.55.2012.10.31.07.27.05; 
     Wed, 31 Oct 2012 07:27:05 -0700 (PDT) 
Received-SPF: pass (google.com: domain of [email protected] designates 65.254.253.98 as permitted sender) client-ip=65.254.253.98; 
Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 65.254.253.98 as permitted sender) [email protected] 
Received: from mailscan13.yourhostingaccount.com ([10.1.15.13] helo=mailscan13.yourhostingaccount.com) 
    by mailout12.yourhostingaccount.com with esmtp (Exim) 
    id 1TTZG5-0005Lf-Dt 
    for [email protected]; Wed, 31 Oct 2012 10:27:05 -0400 
Received: from impout01.yourhostingaccount.com ([10.1.55.1] helo=impout01.yourhostingaccount.com) 
    by mailscan13.yourhostingaccount.com with esmtp (Exim) 
    id 1TTZG2-0007KY-GM 
    for [email protected]; Wed, 31 Oct 2012 10:27:02 -0400 
Received: from cgi1703.yourhostingaccount.com ([10.1.12.150]) 
    by impout01.yourhostingaccount.com with NO UCE 
    id HqT21k00s3EEVBe01qT2XN; Wed, 31 Oct 2012 10:27:02 -0400 
X-Authority-Analysis: v=2.0 cv=IICA+3TG c=1 sm=1 a=0bVzInp0yugA:10 
a=UT1nndvi2uwA:10 a=e1QP36Bl1McA:10 a=Gm7PUgscJ9MA:10 a=jPJDawAOAc8A:10 
a=mM4-eZ0ns8IA:10 a=PgEUWBzPAAAA:8 a=2RTERvT5bsMA:10 a=t2MNXjrCa7SdDSCJ3MYA:9 
a=wPNLvfGTeEIA:10 a=_W_S_7VecoQA:10 a=MvC2+Uy32Q89d9+Fzzoamg==:117 
X-EN-OrigOutIP: 10.1.12.150 
X-EN-IMPSID: HqT21k00s3EEVBe01qT2XN 
Received: from moo.ray023 by cgi1703.yourhostingaccount.com with local (Exim) 
    id 1TTZFR-0003Hw-20 
    for [email protected]; Wed, 31 Oct 2012 10:26:25 -0400 
X-EN-Info: U=moo.ray023 P=/index.php 
X-EN-CGIUser: moo.ray023 
X-EN-CGIPath: /index.php 
X-EN-OrigIP: 173.191.128.136 
To: [email protected] 
Subject: =?iso-8859-1?Q?Your_MySite_Login?= 
X-PHP-Originating-Script: 3651509:Email.php 
User-Agent: CodeIgniter 
Date: Wed, 31 Oct 2012 10:26:24 -0400 
From: "MySite Admin" <[email protected]> 
Reply-To: "[email protected]" <[email protected]> 
X-Sender: [email protected] 
X-Mailer: CodeIgniter 
X-Priority: 3 (Normal) 
Message-ID: <[email protected]> 
Mime-Version: 1.0 
Content-Type: multipart/alternative; boundary="B_ALT_50913511012dd" 
X-EN-Timestamp: Wed, 31 Oct 2012 10:26:25 -0400 
Sender: "MySite Admin" <[email protected]> 

This is a multi-part message in MIME format. 
Your email application may not support this format. 

--B_ALT_50913511012dd 
Content-Type: text/plain; charset=iso-8859-1 
Content-Transfer-Encoding: 8bit 

Your password is Login to MySite 


--B_ALT_50913511012dd 
Content-Type: text/html; charset=iso-8859-1 
Content-Transfer-Encoding: quoted-printable 

<html><body>Your password is <br><a href=3D"http://MySite.com/">Logi= 
n to MySite</a></body></html> 

--B_ALT_50913511012dd-- 

如何與Gmail解決此問題的任何想法?

+0

所有的頭文件都被正確設置,沒有理由gmail應該使用該地址進行回覆。這對其他地址是否也一致?另外,不要通過電子郵件發送明文密碼。這是非常差的安全措施。 – Sammitch

+0

@Sammitch我只在網站上有兩個「用戶」,他們都是我。我瞭解pw的安全問題,但一次只採取一步。如果我超越了單個用戶,我將編寫更安全的pw重置。 – ray

+0

據我所知,這是谷歌強制執行,以防止濫用。換句話說,你不能改變它。 – Repox

回答

2

在測試了一個雅虎郵箱賬戶和一個單獨的Gmail賬戶(兩者都是btw)之後,我發現問題僅限於我的Gmail賬戶。

搜索過了一會兒,我發現了一個good question on SO是指着我to this article(特別說明粗體制造):

我已經經歷了它發送 郵件到我的Gmail帳戶PHP接觸形式相同的問題。如果「發件人」地址與 相同,則在「GMail設置」中將「收件人」地址或配置爲 「發送爲...」帳戶之一,則Gmail會回覆「收件人」地址而不是 「回覆」地址。一個簡單的解決方法是指定一個非Gmail郵箱地址。現在它可以正常工作,並且Gmail正確地遵守 「回覆」地址。毫無疑問,在我看來,這是Gmail中的一個 錯誤。

該部分大膽是我的Gmail設置。

相關問題