2017-10-06 106 views
0

我想发送电子邮件与codeigniter使用Gmail,我的帐户具有必要的权限,实际上它可以与其他应用程序,在这里我离开我的代码,看看他们是否可以帮助我,谢谢。发送电子邮件惠特codeigniter MAMP

我的图书馆发送电子邮件库文件夹中:

private $support = "[email protected]"; 
private $CI; 


public function __construct() 
{ 
    $this->CI =& get_instance(); 
    $this->CI->load->library('email'); 
} 


public function Goemail($email) 
{ 

    $mensaje = "Texto"; 

     $this->CI->email->from($this->support, 'Mynombre'); 
     $this->CI->email->to($email); 
     $this->CI->email->subject('Asunto'); 
     $this->CI->email->message($mensaje);  
     $this->CI->email->send(); 


} 

我的内部应用程序/ conf目录/ email.php配置文件:

$config['protocol'] = 'smtp'; 
$config['smtp_host'] = 'ssl://smtp.googlemail.com'; 
$config['smtp_port'] = 465; 
$config['smtp_user'] = "[email protected]"; 
$config['smtp_pass'] = "mypass"; 

回答

0

这是我的解决方案,显然是笨3您必须在配置文件中强制使用此行email.php

$config ['newline'] = "\r\n";