I read other topics but not resolved my problem..
I have this in my controller:
$this->load->library("email");
$this->email->from(set_value("email"),
set_value("nome"),set_value("msg"));
$this->email->to("my@gmail.com");
$this->email->subject("Mensagem");
$this->email->message(set_value("msg"));
$this->email->send();
echo $this->email->print_debugger();
and my library email:
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail";
var $protocol = "smtp";
var $smtp_host = "smtp.gmail.com";
var $smtp_user = "xxx@gmail.com";
var $smtp_pass = "xxx";
var $smtp_port = "465";
var $smtp_timeout = 5;
var $smtp_crypto = "";
var $wordwrap = TRUE;
var $wrapchars = "76";
var $mailtype = "html";
var $charset = "utf-8";
var $multipart = "mixed";
var $alt_message = '';
var $validate = FALSE;
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail";
var $protocol = "smtp";
var $smtp_host = "smtp.gmail.com";
var $smtp_user = "xxx@gmail.com";
var $smtp_pass = "xxx";
var $smtp_port = "465";
var $smtp_timeout = 5;
var $smtp_crypto = "";
var $wordwrap = TRUE;
var $wrapchars = "76";
var $mailtype = "html";
var $charset = "utf-8";
var $multipart = "mixed";
var $alt_message = '';
var $validate = FALSE;
...
I also change php.ini for: (wamp - bin - apache - apache2.4.4 - bin - php.ini)
extension=php_openssl.dll
But I have da same problem... not work:
Message: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Filename: libraries/Email.php
Line Number: 1553 Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Line Number 1553 for email.php have this:
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']))){ return FALSE;}else{ return TRUE;}
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this-_header_str, "-f ".$this->clean_email($this->_headers['From']))){
return FALSE;
}else{
return TRUE;
}
I need help... tks
Try this self TESTED Code. It may help you. Make sure you have POP3 enabled in gmail Settings.
$config['useragent'] = 'CodeIgniter';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = '*****developer@gmail.com'; // Your gmail id
$config['smtp_pass'] = '**********'; // Your gmail Password
$config['smtp_port'] = 465;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('trimantradeveloper@gmail.com', 'TSS DEV');
$this->email->to('trimantra@trimantra.com');
$this->email->cc('trimantra@gmail.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
Try this:
$ci = get_instance();
$ci->load->library('email');
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "blablabla@gmail.com";
$config['smtp_pass'] = "yourpassword";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";
$ci->email->initialize($config);
$ci->email->from('blablabla@gmail.com', 'Blabla');
$list = array('xxx@gmail.com');
$ci->email->to($list);
$this->email->reply_to('my-email@gmail.com', 'Explendid Videos');
$ci->email->subject('This is an email test');
$ci->email->message('It is working. Great!');
$ci->email->send();
put WAMP server to online also...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.