使用smtp.office365.com和PHP Codeigniter发送电子邮件时出错
请提供帮助,使用SMTP Outlook 365发送电子邮件时出错。 以前它仍然可以运行,但突然出现了一个错误 这些是我的代码使用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
$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能用上吗?我也有同样的问题