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
使用smtp.office365.com和PHP Codeigniter发送电子邮件时出错_Php_Codeigniter_Outlook_Syntax Error_Sendmail - Fatal编程技术网

使用smtp.office365.com和PHP Codeigniter发送电子邮件时出错

使用smtp.office365.com和PHP Codeigniter发送电子邮件时出错,php,codeigniter,outlook,syntax-error,sendmail,Php,Codeigniter,Outlook,Syntax Error,Sendmail,请提供帮助,使用SMTP Outlook 365发送电子邮件时出错。 以前它仍然可以运行,但突然出现了一个错误 这些是我的代码 $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'smtp.office365.com'; $config['smtp_user'] = 'XXX@XXXX.com'; $config

请提供帮助,使用SMTP Outlook 365发送电子邮件时出错。 以前它仍然可以运行,但突然出现了一个错误

这些是我的代码

$this->load->library('email');
    $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'smtp.office365.com';
        $config['smtp_user'] = 'XXX@XXXX.com';
        $config['smtp_pass'] = '@@@@@@@@@';
        $config['smtp_port'] = '587';
        $config['smtp_crypto'] = 'tls';
        $config['starttls'] = FALSE;
        $config['smtp_timeout'] = '5';
        $config['wordwrap'] = TRUE;
        $config['charset']='iso-8859-1';  
        $config['mailtype'] = 'html';
        $config['newline']="\r\n"; 
        $config['crlf']= "\r\n";    
    $this->email->initialize($config);
    //Email content
    $htmlContent = 'XXX';
    $htmlContent .= 'XXX';
    $this->email->to('XXX@XXXX.com');
    $this->email->from('XXXXX@XXXXX.com','MyWebsite');
    $this->email->subject('How to send email via SMTP server in CodeIgniter');
    $this->email->message($htmlContent);
    //Send email
    $this->email->send();
    if($this->email->send())
        {
            echo "Email sent!!"; 
        } else {
            echo "Email is not sent!!";
            echo $this->email->print_debugger();
        }
}
这是一个错误的结果

不是您当前的问题,但您不会想要
$this->email->send()
两次,这样可以发送电子邮件twice@user3783243这只是打字错误,如果代码删除了,还是一样的error@asgart3a能用上吗?我也有同样的问题