代码点火器电子邮件

Code igniter email

你好,我有一个关于代码启动器邮件的问题发送这里是我的代码

function __construct()
{
    parent::__construct();
    $this->load->library('email');


}

    function index()
    {
        $this->load->library('email');
        $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'smtp.mailtrap.io',
            'smtp_port' => 2525,
            'smtp_user' => 'edf81f6d31af91',
            'smtp_pass' => '6d824154999158',
            'crlf' => "\r\n",
            'newline' => "\r\n"
        );
        $this->email->initialize($config);

        $this->email->from('b8748b238c-54555a@inbox.mailtrap.io', 'Your Name');
        $this->email->to('dadycool014@hotmail.com');


        $this->email->subject('Email Test');
        $this->email->message('Testing the email class.');

        $this->email->send();



    }

当我执行这段代码时,我得到了这个错误

遇到了一个PHP错误 严重性:警告

消息:fsockopen():

文件名:libraries/Email.php

行号:2055

回溯:

文件:C:\xampp\htdocs\ctmprod\application\libraries\Email.php 线路:2055 函数:fsockopen

文件:C:\xampp\htdocs\ctmprod\application\libraries\Email.php 行:1950 函数:_smtp_connect

文件:C:\xampp\htdocs\ctmprod\application\libraries\Email.php 线路:1825 函数:_send_with_smtp

文件:C:\xampp\htdocs\ctmprod\application\libraries\Email.php 线路:1715 函数:_spool_email

文件:C:\xampp\htdocs\ctmprod\application\controllers\email.php 线路:51 功能:发送

文件:C:\xampp\htdocs\ctmprod\index.php 线路:315 函数:require_once

function sesnd_mail()
{
    $this->load->library('email');
    $config = array();
    $config['useragent'] = "CodeIgniter";
    $config['mailpath']  = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
    $config['protocol']  = "smtp";
    $config['smtp_host'] = "smtp.sendgrid.net";
    $config['smtp_user'] = "username";
    $config['smtp_pass'] = "password ";        
    $config['smtp_port'] = "25";
    $config['mailtype']  = 'html';
    $config['charset']   = 'utf-8';
    $config['newline']   = "\r\n";
    $config['wordwrap']  = TRUE;
    $this->load->library('email');
    $this->email->initialize($config);        
    $this->email->subject('TEST SUBJECT');
    $this->email->message("THIS IS A TEST MESSAGE");
    $this->email->from( "yyy@gmail.com"  );        
    $this->email->to("xxx@gmail.com");
    if($this->email->send())
    {
    echo "success";
    }
    else
    {
    echo $this->email->print_debugger();
    }   
}