Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter电子邮件发送错误显示fsockopen_Php_Codeigniter_Email - Fatal编程技术网

Php Codeigniter电子邮件发送错误显示fsockopen

Php Codeigniter电子邮件发送错误显示fsockopen,php,codeigniter,email,Php,Codeigniter,Email,我想在codeigniter中发送电子邮件,但显示错误,我尝试了所有可能的选项,但失败 Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused) 这是我的密码 public function mail() { $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://

我想在codeigniter中发送电子邮件,但显示错误,我尝试了所有可能的选项,但失败

Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection refused)
这是我的密码

public function mail()
{
    $config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx@gmail.com',
    'smtp_pass' => 'xxx',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
        $this->email->from('xxx@gmail.com', 'Support');
        $this->email->to('xxx@gmail.com');
        $this->email->subject('Test');
        $this->email->message('This is a test email');
    if (!$this->email->send())
{
            echo $this->email->print_debugger();
}
        else
        {
            echo "Email is sent!!";
    }
}

如果您试图在当前页面中显示图像,并在作为链接单击时打开完整图像

$this->load->helper('url'); // Load URL Helper for base_url() 
$this->load->helper('html'); // Load HTML Helper for img()

$path= base_url('img/servare.png'); // generates text: siteroot/img/servare.png 
echo anchor($path, img($path));
输出:

<a href="http://localhost/nedwara.com/img/servare.png">
   <img src="http://localhost/nedwara.com/img/servare.png" alt="">
</a>

jay您显示的方法是静态的,我在数据库中有一个帖子列表,所以当我们点击标题帖子详细信息页面时,我想在图片上应用同样的方法