Error with Email class

#1
[eluser]Garrisonx[/eluser]
Hi folks mi name is carlos... and this is mi 3rd day using codeigniter it seems really interesting and powerfull i'm really interested in learn this framework.
actually i was reading the video tutorial from nettuts.
http://net.tutsplus.com/videos/screencas...tch-day-3/

sending email with codeigniter

and everything was great Tongue
but when the program in the video compiles fine in mi computer apears a thousand errores that doesnt appear there i wonder if there is a special configuration for the email class or is something wrong in mi computer.

my constructor is fine
and mi index function is fine too
even my $config variable shows no mistake but when i start running the email methods



Code:
echo "Pagina para enviar emails";
        /**
        *
        */
        $config = Array(
            'protocol'=>'smtp',
            'smtp_host'=>'ssl://smtp.googmemail.com',
            'smtp_port'=>465,
            'smtp_user'=>'[email protected]',
            'smtp_pass'=>'mypass'
                      
                       );
        
        $this->load->library('email',$config);
        $this->email->set_newline("\r\n");
        $this->email->from('[email protected]','Garrison');
        $this->email->to('[email protected]');
        $this->email->subject('This is an Email test');
        $this->email->message('This mail is working Great!!');
        
        
        if($this->email->send()){
            echo "Your mail was sent, Fool"    ;
            }
        else{
            show_error($this->email->print_debugger() );
            }

this is mi index function

and this are the errors
Filename: libraries/Email.php

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googmemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Line Number: 1652


Message: fwrite(): supplied argument is not a valid stream resource Line Number: 1795 (6 times same error)
Message: fgets(): supplied argument is not a valid stream resource Line Number: 1818 (5 times same error)
am i missing something.... i think thaty maybe the class dont accept the $config variable and the methods could be exaclty the 11 errors


and then the big one...
the show_error debugger


but i think maybe this is because ssl ports change or something like that

#2
[eluser]Garrisonx[/eluser]
i was checking line by line where the errors start and it seems like the $config is fine and
$this->email-> all of them work fine 2

the problem starts with the


Code:
if($this->email->send())
{
echo "Your mail was sent, Fool"    ;
}
else
{
show_error($this->email->print_debugger() );
}

#3
[eluser]skunkbad[/eluser]
Does your server have an SSL certificate properly installed? Your error is alerting you that you need an encrypted connection which is not available. You should fix that first and see what happens.

#4
[eluser]theprodigy[/eluser]
Quote:'smtp_host'=>'ssl://smtp.googmemail.com'
try changing that to
Code:
'smtp_host'=>'ssl://smtp.googlemail.com'

I believe it is GOOGLEmail, not GOOGMEmail.

#5
[eluser]Garrisonx[/eluser]
function index(){

$config = Array(
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_port'=>465,
'smtp_user'=>'[email protected]',
'smtp_pass'=>'mypass'

);
still wrong

#6
[eluser]Garrisonx[/eluser]
this is the page
http://codeigniter.impormac.com/index.php/email/
this is the code
Code:
<?php
/**
* Send email with Gmail
*/
class Email extends Controller{
    function __construct(){
        parent::Controller();
        }
    
    function index(){
        
        $config = Array(
            'protocol'=>'smtp',
            'smtp_host'=>'ssl://smtp.googlemail.com',
            'smtp_port'=>465,
            'smtp_user'=>'[email protected]',
            'smtp_pass'=>'mypass'
                      
                       );
            
        $this->load->library('email',$config);
        $this->email->set_newline("\r\n");
        $this->email->from('[email protected]','Garrison');
                
        $this->email->to('[email protected]');
        $this->email->subject('This is an Email test');
        $this->email->message('This mail is working Great!!');
        
        echo "sin errores";
        if($this->email->send()){
            echo "Your mail was sent, Fool"    ;
            }
        else{
            show_error($this->email->print_debugger() );
            }
        
        
        
        
        
        
        
        }
    
    
    }

?>

#7
[eluser]skunkbad[/eluser]
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googmemail.com:465 (Unable to find the socket transport “ssl” - did you forget to enable it when you configured PHP?)
Line Number: 1652

#8
[eluser]Garrisonx[/eluser]
so i have to enable it in php.ini ... let me check ty

#9
[eluser]Truong Le[/eluser]
If open_ssl is not complied with PHP or it is not enabled from php.ini file, you will see that error.

Solution in Linux:

Compile PHP with open_ssl, command-

–with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)

Windows with XAMP:

Stop your Apache service
Find libeay32.dll and ssleay32.dll in xampp\php\ folder, and copy it into xampp\apache\bin\ folder. Overwrite the older files in there.
Edit php.ini file in xampp\apache\bin, remove the semicolon in “;extension=php_openssl.dll
Start the Apache service

Windows with WAMP2:

From WAMP tray menu, go to PHP Extension
Check php_openssl
Apache will be restarted

I hope it's useful for you


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.