CodeIgniter Forums

Full Version: email class new line issues [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi there,

I'm trying to make a new line in my email message body, but what used to work in my old procedural PHP script doesnt work in CodeIgniter.

any suggestions? here's my code:

$message = 'Hey ' . $effecteduser->username . ",\n";
                    $message .= $user->username . " wants to add you as a contact. You can view their portfolio here:";
                    $message .= $this->ci->config->item('base_url') . $user->usernameid;
                    $message .= "\n Click here to decide: " . $this->ci->config->item('base_url') . "dashboard";
                    $message .= "\nSee you!";
                    $message .= " \n \n ---------------------------------------------------------------------";
                    $message .= " \n To control what mail gets sent to you from us you can manage your notifications here: " . $this->ci->config->item('base_url') . "settings/account";

El Forum

Are you setting your email to be HTML or plain text? In HTML the "\n" wouldn't appear as expected.

El Forum

Use the CodeIgniter Email Class Library.

CodeIgniter Users Guide


El Forum

@InsiteFX - I am using the CodeIgniter email class. ie. $this->ci->email->message($message);

@SitesByJoe - Thanks, that was the issue. I needed to change my email config file from

$config['mailtype'] = 'html';
$config['mailtype'] = 'text';