我使用CI3及其电子邮件库通过Office365 SMTP服务器发送电子邮件。这是我的代码:
bind
大部分时间一切正常。但有时这是我在错误日志中得到的:
$config['mailtype'] = 'html';
$config['smtp_crypto'] = 'tls';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = '[USERNAME]';
$config['smtp_pass'] = '[PASSWORD]';
$config['smtp_port'] = '587';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf'] = "\r\n";
$this->email->initialize($config);
$this->email->from('[FROM]', '[FROM NAME]');
$this->email->reply_to('[REPLY TO]', '[REPLY TO TEXT]');
$this->email->to($message['email']);
$this->email->subject($message['subject']);
$this->email->message($output);
$this->email->send()
主要问题是,当这种情况开始发生时,它不会停止,直到我重新启动服务器或服务器耗尽磁盘空间!并且它发生得非常快,每秒几MB的数据,这意味着在很短的时间内文件大小只有几GB!
我不确定,这实际上与CI有关,或者它可能是服务器问题?
谢谢!
答案 0 :(得分:0)
我不认为这很重要,但我在顶部的这个订单协议中尝试,因为我检查了StackOverflow,这是其他人所拥有的。
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_crypto']= 'tls';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = 'test@host.com';
$config['smtp_pass'] = 'PASSWORD';
$config['smtp_port'] = '587';
$config['charset']='utf-8';
$config['newline']="\r\n";
$config['crlf'] = "\r\n";
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('demo@demo.com', 'Johe Doe');
$this->email->to(blah@demo.com);
$subject = 'Some Thing';
$this->email->subject($subject);
$message = 'Hello Test';
$this->email->message($message);
$this->email->send();
Codeigniter 2用户指南http://www.codeigniter.com/userguide2/libraries/email.html
Codeigniter 3 http://www.codeigniter.com/user_guide/libraries/email.html
删除下面的行。
$this->email->reply_to('[REPLY TO]', '[REPLY TO TEXT]');