2013-02-21 90 views
1

我在我的網站上創建了一個聯繫表單,並且爲了將電子郵件發送到網站帳戶([email protected]),我使用的是Gmail郵件,使用Gmail我會收到相同的電子郵件。回覆 - 使用gmail發送codeigniter電子郵件smtp

因此,用戶轉到我的網站,點擊聯繫頁面,填寫表格: 姓名,電子郵件,留言。

比我發送電子郵件用下面的代碼:

 $config = Array(
     'protocol' => 'smtp', 
     'smtp_host' => 'ssl://smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '[email protected]', 
     'smtp_pass' => 'mypass', 
     'mailtype' => 'html', 
     'charset' => 'utf-8' 
    ); 
    $this->load->library('email', $config); 
    $this->email->set_newline("\r\n"); 

    $email = $this->input->post('email'); 
    $name = $this->input->post('name'); 
    $msg = $this->input->post('msg'); 
    $this->email->to('[email protected]'); 
    $this->email->reply_to($email); //User email submited in form 
    $this->email->from($email, $name); 
    $this->email->subject('Conctact form'); 
    $this->email->message($msg); 
    if ($this->email->send()) 
    { 
     return true; 
    } else 
    { 
     echo $this->email->print_debugger(); 
     return false; 
    } 

電子郵件進入我的收件箱中的「[email protected]」,我可以正常讀取的消息,但...當我點擊「回覆」,而不是回覆給我發送信息的用戶,它回覆「我」([email protected])。

我已經配置了reply_to,回覆用戶地址,不是我的,但仍然會去[email protected]

如何解決這個問題? 我應該更改代碼或gmail設置中的更多內容嗎?

(PS:我使用Gmail界面來閱讀電子郵件,直接從網站mail.google.com)

謝謝提前。

- 此外,當我收到郵件,它顯示: 「發件人:‘名稱提交表單’」

不: 「來源:<「電子郵件‘在提交的表單名稱’在提交表格'>「 喜歡它應該是。

回答

1

Gmail做到了這一點,我不認爲有任何解決方法。

「發件人」地址只會是您用來發送電子郵件的帳戶 - 您不能簡單地「通過」Gmail服務器。

如果你需要做的是,你需要像SendGrid或您自己的SMTP服務器

+0

使用sendmail,有什麼機會......? – StiveKnx 2013-02-21 23:52:08

相關問題