why the CI can't send email

#1
[eluser]DogWin[/eluser]
Hi,
I came to a problem,when I used CI to send email.It isn't working!
Code:
function send_email(){
        $config = array(
        'protocol'=>'smtp',
        'smtp_host'=>'ssl://smtp.googlemail.com',
        'smtp_port'=>465,
        'smtp_user'=>'weblsfamily@gmail.com',
        'smtp_pass'=>'*************',
        'charset'=>'iso-8859-1',
        'mailtype'=>'html'
        );
        $this->email->initialize($config);
        $this->email->set_newline("\r\n");
        $this->email->from('weblsfamily@gmail.com','DogWin');
        $this->email->to('lsfamily_boy@qq.com');
        $this->email->subject('the subject');
        $this->email->message('message:hello!');
        //$this->email->attach('images/loading.gif');
        if($this->email->send()){
            echo "send successful!";
        }else{
            show_error($this->email->print_debugger());
            echo "send failed!";
        }
    }
The Error:
A PHP Error was encountered
Severity: Warning

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

Filename: libraries/Email.php

Line Number: 1652

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fwrite(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1795

A PHP Error was encountered
Severity: Warning

Message: fgets(): supplied argument is not a valid stream resource

Filename: libraries/Email.php

Line Number: 1818

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\zrof\system\libraries\Exceptions.php:166)

Filename: codeigniter/Common.php

Line Number: 360

#2
[eluser]whitey5759[/eluser]
Looks like you don't have openssl installed on that server. This, I believe, is required to send email via services such as Gmail.

#3
[eluser]DogWin[/eluser]
[quote author="whitey5759" date="1257336096"]Looks like you don't have openssl installed on that server. This, I believe, is required to send email via services such as Gmail.[/quote]那应该怎么办啊?

#4
[eluser]whitey5759[/eluser]
[quote author="DogWin" date="1257336961"][quote author="whitey5759" date="1257336096"]Looks like you don't have openssl installed on that server. This, I believe, is required to send email via services such as Gmail.[/quote]那应该怎么办啊?[/quote]

Ahh see that I can't help you with, as all my servers are Linux and yours appears to be Windows. On Linux it's dead easy. A quick google showed plenty of people talking about the exact same issue when running PHP under Windows.

#5
[eluser]daru.rj[/eluser]
i recommend using phpmailer library. it's easy to integrate to CI.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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