2012-02-27 198 views
0

我尝试在本地主机上使用codeigniter发送电子邮件。Codeigniter - 发送电子邮件

为了,在config目录下我打开名为电子邮件新的PHP文件

,写

<?php 

$config = Array(
    'protocol' => 'smtp', 
    'smtp_host' => 'ssl://smtp.googlemail.com', 
    'smtp_port' => 465, 
    'smtp_user' => '[email protected]', 
    'smtp_pass' => 'pass', 
); 
$this->load->library('email', $config); 

?> 

,并在我的控制器写这篇

$this->load->library('email'); 
     $this->email->from('[email protected]','Pasaj.com'); 
     $this->email->to($email); 
     $this->email->subject('pasaj hesabinizi aktive etmek icin'); 
     $this->email->message('Tıkla'); 
     $this->email->send(); 

,但我得到这些错误:

enter image description here

我在互联网上做了一些研究,我读到我必须从我的php.ini文件启用ssl,但没有行我喜欢我能做什么?

TY

+0

也尝试使用TLS代替(不记得端口现在) – 2012-02-27 10:45:54

+0

有一样,在我的php.ini文件 – 2012-02-27 10:47:37

+1

@MertMETİN没有行:这是在Windows或Linux?如果是Windows,则需要安装[OpenSSL for Windows](http://www.openssl.org/related/binaries.html),并在'php.ini'中取消对'extension = php_openssl.dll'的注释。 – stealthyninja 2012-02-27 11:01:37

回答

0

试试这个:

$this->email->initialize($config); 

,而不是这样的:

$this->load->library('email', $config); 

你的控制器是这样的:

$this->load->library('email'); 
$this->email->from('[email protected]','Pasaj.com'); 
$this->email->to($email); 
$this->email->subject('pasaj hesabinizi aktive etmek icin'); 
$this->email->message('Tıkla'); 
$this->email->send(); 

也许这是一件好事发表你的答案t从CodeIgniter Forums

0

试试这个;

$email =$this->input->post('email'); 
$this->load->library('email'); 
$this->email->from('[email protected]','Pasaj.com'); 
$this->email->to($email); 
$this->email->subject('pasaj hesabinizi aktive etmek icin'); 
$this->email->message('Tıkla'); 
$this->email->send();