Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.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 电子邮件代码点火器不工作_Php_Codeigniter_Email_Ssl - Fatal编程技术网

Php 电子邮件代码点火器不工作

Php 电子邮件代码点火器不工作,php,codeigniter,email,ssl,Php,Codeigniter,Email,Ssl,我正试图从我的本地主机向用户发送一封电子邮件,询问他们忘记的密码。(测试) 此功能在我的控制器中 // Send Request Email public function send_email() { $config = Array( 'protocol' => 'smtp', 'smtp_host' =>

我正试图从我的本地主机向用户发送一封电子邮件,询问他们忘记的密码。(测试) 此功能在我的控制器中

// Send Request Email
public function send_email()
{
        $config = Array(
                                        'protocol' => 'smtp',
                                        'smtp_host' => 'ssl://smtp.googlemail.com',
                                        'smtp_port' => 465,
                                        'smtp_user' => '***@gmail.com', // change it to yours
                                        'smtp_pass' => '***', // change it to yours
                                        'mailtype' => 'html',
                                        'charset' => 'iso-8859-1',
                                        'wordwrap' => TRUE
                                    );

        $message = '';
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $this->email->from('***@gmail.com', "Mama"); 
        $this->email->to('***@gmail.com');
        $this->email->subject('Mama Needs You');
        $this->email->message($message);

        if($this->email->send())
        {
                echo 'Email sent to Mama.';
        }
        else
        {
                show_error($this->email->print_debugger());
        }
}
用户输入电子邮件并单击请求按钮后,AJAX调用将请求上述功能(发送电子邮件)。但答案是这样的

A PHP Error was encountered
严重性:警告

消息:fsockopen():SSL操作失败,代码为1。OpenSSL错误 消息:错误:14090086:SSL 例程:ssl3\u获取\u服务器\u证书:证书验证失败

文件名:libraries/Email.php

电话号码:2055

回溯:

文件:D:\xampp\htdocs\prototype\application\controllers\Manage.php 行:191功能:发送

文件:D:\xampp\htdocs\prototype\index.php行:315函数: 需要一次

遇到PHP错误严重性:警告

消息:fsockopen():未能启用加密

文件名:libraries/Email.php

电话号码:2055

回溯:

文件:D:\xampp\htdocs\prototype\application\controllers\Manage.php 行:191功能:发送

文件:D:\xampp\htdocs\prototype\index.php行:315函数: 需要一次

遇到PHP错误严重性:警告

消息:fsockopen():无法连接到 ssl://smtp.googlemail.com:465 (未知错误)

文件名:libraries/Email.php

电话号码:2055

回溯:

文件:D:\xampp\htdocs\prototype\application\controllers\Manage.php 行:191功能:发送

文件:D:\xampp\htdocs\prototype\index.php行:315函数: 需要一次

**试试这个**

    public function index()
    {
        $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'smtp3.netcore.co.in',
        'smtp_port' => 25,
        'smtp_user' => 'support@9abusiness.com',
        'smtp_pass' => 'Supp0rt',
        'mailtype'  => 'html', 
        'charset' => 'utf-8',
        'wordwrap' => TRUE
    );

        $this->load->library('email',$config);
        $this->email->from('support@9abusiness.com', 'Support');
        $this->email->to('abdularbaaz@gmail.com');
        $this->email->cc('');
        $this->email->bcc('');

        $this->email->subject('Test');
        $this->email->message('This is a test email');

    if ( ! $this->email->send())
{
    // Generate error
    echo "Email is not sent!!";
}

        echo $this->email->print_debugger();

    }

}

感谢您回答我的问题,先生@pardeep,我尝试了上面的代码,这是AJAX调用的回复:Message:fsockopen():无法连接到smtp3.netcore.co.in:25(连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应。)

无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。您的配置文件夹中是否有email.PHP文件?其中的配置可能有问题。也许您应该尝试$config['mailtype']='text';mailtype html已经给我造成了一些问题。或者尝试删除整个配置文件以使用默认设置我的配置文件夹中没有email.php..我的控制器中只有上面的那行代码我尝试删除控制器中的配置代码,但错误与我上面提到的相同:/i我觉得没有希望