Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Problems with Email Class. Newline and Crlf
#1

[eluser]Sinclair[/eluser]
Hi,

I'am with some problems in the emails class.

My application write the emails to the database and then I read the emails from the database to send them.

My configurations for Newline and Crlf are the following:
Code:
$config['protocol'] = 'sendmail';
        $config['mailpath'] = '/usr/sbin/sendmail';
        $config['charset'] = 'utf-8';
        $config['wordwrap'] = TRUE;
        $config['mailtype'] = 'text';
        $config['newline'] = '\r\n';
        $config['crlf'] = '\r\n';

1 - When I test sending the email like this, the newline and crlf works:
Code:
$this->email->message("Testing \n\nFFF");

This results in:
Quote:Testing

FFF


2 - But if I read from the database with the same content, does not work, the message appear like this:
Code:
$this->email->message($dados_email->email_msg);

This results in:
Quote:Testing \n\nFFF

What can I do to solve this problem?


Best Regards
#2

[eluser]pickupman[/eluser]
What do you get when you echo out the variable from the DB? Is it printing the characters or the carriage return?
#3

[eluser]Sinclair[/eluser]
Hi,

The problem is solved. The problem was the database that escape "\". My solution was to replace the "@break_line@" in the message with "\n" using str_replace(). Dumb solution but it works.

Best Regards,
#4

[eluser]pickupman[/eluser]
In active record class you can pass false to some of your DB statements to disable escaping the data.




Theme © iAndrew 2016 - Forum software by © MyBB