Welcome Guest, Not a member yet? Register   Sign In
email class and smtp
#1

[eluser]Alix.G[/eluser]
Hi,

I don't know why but ci failed to send email using the smtp protocol. The thing is that I get no error message the page is always loading and nothing happens. When I use the standard settings it works just fine.

Here is the code in my controller:
Code:
$this->load->library('email');
            
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'password';
            
$this->email->initialize($config);
            
$this->email->set_newline('\r\n');
$this->email->from('[email protected]', 'alix');
$this->email->to('[email protected]');
            
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');    
            
$this->email->send();
            
echo $this->email->print_debugger();

I'm running ci localy on xampp

Update: I get that:
Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampplite\htdocs\gremco\site\system\libraries\Email.php on line 1818
#2

[eluser]bretticus[/eluser]
Line 1818, is code that loops through the smtp server responses. When you use the standard settings, I suspect that CI just hands the mail off to intrinsic PHP mail() function. It's using fgets to read each line from an fsockopen function call. That function is called with a 5 second timeout default setting, and with the error line coming on 1818, it would appear that the connection doesn't timeout, but your system cannot read from the handle that fsockopen returns. What you really need is a debugger for this problem. Google xampp debugger.

Also, not sure, because the socket seems to be open, but make sure that you have openssl.dll in xampp's php.ini (according to xampp's website it appears that OpenSSL comes with xammp standard.)

Good luck!
#3

[eluser]Alix.G[/eluser]
Thank you, I'm going to look in this direction Smile




Theme © iAndrew 2016 - Forum software by © MyBB