-1

我正在使用带有 wamp 的 codeIgniter 作为本地服务器,我编写了发送电子邮件代码

 $config = array( 
      'protocol'=>'smtp',
      'smtp_port'=>'465',
      'smtp_host'=>'ssl://smtp.googlemail.com',
      'smtp_user'=>'myemail@gmail.com',
      'smtp_pass'=>'*********'
    );
    $this->load->library('email',$config);
    $this->email->set_newline("\r\n");//set the new line rule 
    $this->email->from('myemail@gmail.com', 'Imran Tufail');
    $this->email->to('myemail@gmail.com');

    $this->email->subject('Email Test');
    $this->email->message("The stuff works");

    if($this->email->send())
    {
         echo "Mail sent ";
    }
    else{
    echo $this->email->print_debugger();
        }
    }

此代码正在生成错误

A PHP Error was encountered
Severity: Warning
Message: 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?)

文件名:库/Email.php

行号:1869

遇到以下 SMTP 错误:1706213911 无法找到套接字传输“ssl” - 您在配置 PHP 时是否忘记启用它?

4

1 回答 1

2

我解决了我的问题。因为我们使用的是 ssl smtp 并且没有在 wamp 服务器中启用 ssl 扩展

所以转到任务栏中的 wanpserver 图标,

  wampserver->php->phpextansions-> then check the php_openssl extansion
于 2012-12-24T02:34:47.920 回答