2016-02-02 155 views
2

我已经使用了这几种方法,但似乎无法得到它的工作。我在实时服务器上运行它。说电子邮件发送,但没有收到时使用Codeigniter发送电子邮件

我使用bigrock主机,并根据他们的文件说,只是使用“本地主机”作为smtp主机。 Link

它说,电子邮件发送,但我什么也没得到。在提前

public function index() { 
    $config = array(
     'protocol' => 'smtp', 
     'smtp_host' => 'localhost', 
     'smtp_port' => '587', 
// Other way it say Email sent 
     //'smtp_host' => 'ssl://localhost', 
     //'smtp_port' => '465', 
     'smtp_user' => '[email protected]', 
     'smtp_pass' => 'sdfsfsdfsd' 
    ); 
     $this->load->library('email', $config); 
     $this->email->set_newline("\r\n"); 
     $this->email->from('[email protected]', 'ABC'); 
     $this->email->to('[email protected]'); 
     $this->email->subject('Test'); 
     $this->email->message('Success'); 
    if ($this->email->send()) { 
      echo 'Email Sent'; 
     } else { 
      show_error($this->email->print_debugger()); 
     } 
} 

感谢。

回答

2

This line:$ this-> email-> to('abc @ gmail');使其'[email protected]',并确保它是现有的..如果它仍然无法正常工作,尝试一个合理的电子邮件从你的email-> from。

+0

非常感谢..愚蠢的我.. –

+0

没问题:)它工作? –

+0

是的,它没有..谢谢, –