2017-10-06 1 views
0

Je suis en train d'envoyer un courriel en utilisant gmail avec codeigniter, mon compte a les autorisations nécessaires en fait, il fonctionne avec d'autres applications, ici je laisse mon code pour voir si elles peuvent m'aider, Merci.Envoyer un e-mail whit codeigniter MAMP

Ma bibliothèque pour envoyer un courriel dans le dossier Bibliothèque:

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(); 


} 

Mon fichier de configuration à l'intérieur Applications/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"; 

Répondre

0

Ce fut la solution pour moi, apparemment dans CodeIgniter 3 vous devez mettre cette ligne obligatoire dans le fichier de configuration email.php

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