2017-10-06 117 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";