2013-02-21 217 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