When I try to send email with Codeigniter email is not send with newlines. I tried some of tecniques written stackoverflow but not worked.
Here is my codes :
$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('[email protected]');
$this->email->to('[email protected]');
$this->email->subject('Today New Sites');
$this->email->message($message);
$this->email->send();
I tried those also :
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']
Any help please?
Use double-quotes "
instead of single-quotes '
. This way the newline \n
will work.
Change $config['mailtype'] = 'html';
and use <br/>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With