当我尝试使用 Codeigniter 发送电子邮件时,电子邮件不会使用换行符发送。我尝试了一些编写 stackoverflow 的技术,但没有奏效。
这是我的代码:
$message = 'Hi everyone\r\n';
$message .= 'Today you can look at these sites\r\n';
$message .= 'Have a good days';
$config['charset'] = 'utf-8';
$config['mailtype'] = 'text';
$config['newline'] = '\r\n';
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('xxxxx@xxx.com');
$this->email->to('aaaa@aaaaaa.com');
$this->email->subject('Today New Sites');
$this->email->message($message);
$this->email->send();
我也试过了:
1.instead of putting \r\n, I put only \n and changed $config['newline'] = '\n'
2.I tried $this->email->message(nl2br($message));
3.I tried : str_replace('\r\n','"\r\n",$message);
4.I get rid of $config['mailtype']
请问有什么帮助吗?