• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New Lines In Message Not Showing Up

I have now been able to send emails OK.

How ever when I revive them they do not show my new lines its just in all one line

How do I make sure it displays the correct format.

PHP Code:

$this->email->subject('Customer Activation');

$key =  md5(microtime().rand());

$message "Thank you for creating a free account!";
$message .= "\r\n";
$message .= "Click on link to validate your email";
$message .= "\r\n";
$message .= anchor('account/register/validated/' $key'Click Here To Validate Email');

if (
$this->register_model->create_temp_account($key)) {


$data['success'] = '';

$data['header'] = Modules::run('catalog/common/header/index');
$data['footer'] = Modules::run('catalog/common/footer/index');


Config > email.php

PHP Code:

['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '****';
$config['smtp_pass'] = '****';
$config['protocol' 'smtp';
$config['validate' true;
$config['mailtype' 'html';
$config['charset'  'utf-8';
$config['newline'  "\r\n"
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!

If mailtype is html, your message must be in html.
So instead of "\r\n", simply use the <br /> tag to add a new line. You can also put <p>...</p> around parts of text to create paragraphs.

Or just enclose the message in nl2br.

Normally with HTML emails I would send the data to a view and return it as a string to use in the email message field. Gives a much cleaner controller code and keeps html in views. You also need to send the entire message as a full html page.

Best wishes,


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.