Php CodeIgniter电子邮件不';行不通
我配置了一个可通过本地主机访问的SMTP服务器 PHP mail()命令运行良好,我在计划任务中使用它将备份作为附件发送电子邮件 如果我使用CodeIgniter v1.7.2电子邮件库使用以下代码,并且CI调试输出显示消息已发送,但SMTP服务器日志显示发件人错误Php CodeIgniter电子邮件不';行不通,php,codeigniter,smtp,email,Php,Codeigniter,Smtp,Email,我配置了一个可通过本地主机访问的SMTP服务器 PHP mail()命令运行良好,我在计划任务中使用它将备份作为附件发送电子邮件 如果我使用CodeIgniter v1.7.2电子邮件库使用以下代码,并且CI调试输出显示消息已发送,但SMTP服务器日志显示发件人错误 $this->CI->load->library('email'); $config['protocol'] = 'mail'; $config['smtp_hos
$this->CI->load->library('email');
$config['protocol'] = 'mail';
$config['smtp_host'] = 'localhost';
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n"; // CHANGED FROM DEFAULTS
$config['newline'] = "\r\n"; // CHANGED FROM DEFAULTS
$this->CI->email->initialize($config);
$this->CI->email->from('noreply@hiddendomain.com');
$this->CI->email->to($_POST['email']);
$this->CI->email->subject('Password Reset');
$this->CI->email->message('Testing the email class. <a href="http://www.google.co.uk">test</a>');
$this->CI->email->send();
这是通过CodeIgniter发送后的日志,因为您可以看到CI电子邮件库正在将03/10/11 16:26:42 ME-I0107: [568] Relay Granted: Sender IP (127.0.0.1) is within an authorized IP range.
03/10/11 16:26:42 ME-I0149: [568] B1D7A0FCDF44403291E8EAD33F5F144F.MAI was received successfully and delivery thread was initiated
03/10/11 16:26:42 ME-I0074: [568] (Debug) End of conversation
03/10/11 16:26:42 ME-I0018: [38DFE013802046528FAC7823871869CC.MAI] Outbound message from ([SMTP:<noreply@hiddendomain1.com]) requeued as [AC83949E463246DDBD022BBF355D4606.MAI] to the target domain [hiddendomain2.com]
03/10/11 16:26:42 ME-I0123: Domain [hiddendomain2.com] has MX list [mailserver.hiddendomain2.com]
03/10/11 16:26:42 ME-I0026: [AC83949E463246DDBD022BBF355D4606.MAI] Sending message
03/10/11 16:26:42 ME-IXXXX: [AC83949E463246DDBD022BBF355D4606.MAI] Remote server returned a response indicating a permanent error. Server Response: (501 Bad sender address syntax**)
03/10/11 16:26:42 ME-E0036: [AC83949E463246DDBD022BBF355D4606.MAI] MAIL FROM command Failed.
03/10/11 16:26:42 ME-E0008: [AC83949E463246DDBD022BBF355D4606.MAI] Outbound, could not send the command to the server (error 10038).
03/10/11 16:26:42 ME-E0060: [AC83949E463246DDBD022BBF355D4606.MAI] - Message could not be delivered to target domain (hiddendomain2.com). Message returned to Sender.
03/10/11 16:26:43 ME-I0119: Domain [hiddendomain1.com] has used local loopback address [127.0.0.1] because it is hosted locally.
03/10/11 16:26:43 ME-I0026: [AC83949E463246DDBD022BBF355D4606.MAI] Sending message
03/10/11 16:26:43 ME-I0102: [572] Address ([SMTP:<noreply@hiddendomain1.com]) is to be delivered to Catch-All address.
03/10/11 16:26:43 ME-I0149: [572] CAEFBF802B8646DB99B4D2401571AE3E.MAI was received successfully and delivery thread was initiated
03/10/11 16:26:43 ME-I0049: [AC83949E463246DDBD022BBF355D4606.MAI] Send Completed Successfully
03/10/11 16:26:43 ME-I0074: [572] (Debug) End of conversation
03/10/11 16:26:43 ME-I0132: Catch-All Message rendered for CAEFBF802B8646DB99B4D2401571AE3E.MAI
03/10/11 16:26:42 ME-I0107:[568]已授予中继:发送方IP(127.0.0.1)在授权的IP范围内。
2011年10月3日16:26:42 ME-I0149:[568]B1D7A0FCDF44403291E8EAD33F5F144F.MAI已成功接收并启动传递线程
03/10/11 16:26:42 ME-I0074:[568](调试)对话结束
03/10/11 16:26:42 ME-I0018:[38DFE013802046528FAC7823871869CC.MAI]来自([SMTP:我以前也有同样的问题,我在代码中做了以下更改:
$config['protocol'] = 'smtp';
$config['validate'] = 'FALSE';
$config['protocol']='smtp';
$config['validate']='FALSE';
我希望这对你有用
$config['protocol'] = 'smtp';
$config['validate'] = 'FALSE';