Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
789 views
in Technique[技术] by (71.8m points)

codeigniter - fsockopen(): unable to connect to ssl://smtp.gmail.com:465

$config = array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.gmail.com',
    'smtp_port' => '465',
    'smtp_user' => "[email protected]", 
    'smtp_pass' => "xxxxxxx", // change it to yours
    'mailtype'  => 'html', 
    'charset'   => 'utf8'
);

$this->load->library('email',$config);

$this->email->set_newline("
");
$this->email->set_crlf( "
" );

$this->email->from($config['smtp_user']);
$this->email->to($email['user_email']);         
$this->email->subject($row['tplsubject']);
$this->email->message(html_entity_decode($email_subject));
$this->email->send();

This code not working its showing error

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.gmail.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: 1689

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I am facing the same problem with Email on a server, the solution for this problem is to change the 'protocol' from 'smtp' to 'ssmtp' and 'smtp_host' from 'ssl://smtp.gmail.com' to 'ssl://ssmtp.googlemail.com'. This thing is working fine for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...