【发布时间】:2018-09-08 10:37:38
【问题描述】:
我正在使用 CodeIgniter 使用此代码发送电子邮件:
$config['protocol'] = "smtp";
$config['smtp_host'] = "mail.******.com";
$config['smtp_port'] = "25";
$config['smtp_user'] = "****@****.com";
$config['smtp_pass'] = "*****";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['send_multipart'] = \r\n;
$config['crlf'] = "\r\n";
$this->email->initialize($config);
$this->email->set_newline("\r\n");
当我在在线服务器(公共主机)上运行时,它会成功。
但是当我在自己的本地服务器上执行代码时出现以下错误。
Failed to send AUTH LOGIN command. Error:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
我的代码或服务器配置是否有任何错误?
【问题讨论】:
-
你加载了
$this->load->library('email');吗?或检查smtp_port为587 -
我把库放在最上面
标签: php codeigniter email