2013-01-09 58 views
0

我正在使用以下代碼發送電子郵件。但是當我按回覆電子郵件時,它會在我的電子郵件中顯示爲「[email protected]」,並且它會將它發送到「[email protected]」 不知道我是否做了錯誤的事情或?Codeigniter郵件無法正常工作

$this->email->from($this->input->post('email'), $this->input->post('thename')); 
$this->email->reply_to($this->input->post('email'), $this->input->post('thename')); 
$this->email->to('[email protected]'); 
$this->email->subject('New Feedback'); 
$this->email->message($this->input->post('message')); 
$this->email->send(); 
+0

我覺得REPLY_TO是多餘這裏.. – NightMICU

+0

嘗試用$這個 - >的電子郵件 - >從($這個 - >輸入 - >後( '電子郵件'));和$ this-> email-> reply_to($ this-> input-> post('email')) – Saleem

+0

如果有任何異常? –

回答

0

我成立笨v 2.1.2一個簡單的電子郵件測試如下:

$this->email->from('[email protected]','Malcom'); 
    $this->email->reply_to('[email protected]','AWD'); 

    $this->email->to('[email protected]'); 

    $this->email->subject('Subject Mailer-Test'); 
    $this->email->message('Lorem est email.'); 

    $this->email->send(); 

    $rc_email = $this->email->print_debugger(); 

我建議你去通過下面的調試過程。

(1)硬代碼在從和REPLY_TO制定者的所有電子郵件地址和名稱。測試以確定問題是否仍然存在。

(2)如果步驟(1)解決了這個問題,那麼就有可能是錯的與你的輸入變量,從而嘗試打印出變量(附加到電子郵件正文)。

(3)打印出的文字從print_debugger

返回

(4)我測試了Mozilla Thunderbird中的電子郵件並如期而來,REPLY_TO和領域工作。你使用哪個電子郵件客戶端?什麼郵件服務器(如果在本地測試)?

請保持我們的發佈與您的進度。

+0

接受你的答案是正確的,因爲它是第4點,讓我意識到我正在使用本地主機。 – james

0

我想通了。我已經將該網站上傳到我的「真實」服務器,並忘記更改網站的基礎。我仍將它作爲本地主機。所以每當我發送一封電子郵件時,它都使用我的本地主機和我在phpmailer中設置的電子郵件。

我認識很多愚蠢的錯誤,但作爲彌補超過20小時就可以做到這一點的人。

感謝您的幫助。

+0

Hello James,很高興我的意見能夠引導您調試問題。這些愚蠢的錯誤發生在我們所有人身上,而且第二組眼睛看到這些明顯的東西是非常有幫助的。祝你工作順利! –

相關問題