Welcome Guest, Not a member yet? Register   Sign In
email class problem with other language
#1

[eluser]shinokada[/eluser]
If I use English I have no problem to send email. However when I try to send it in Norwegian, it send email but I get the following error.

Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\ci\system\language\norwegian\email_lang.php:1)

Filename: libraries/Session.php

Line Number: 662
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\ci\system\language\norwegian\email_lang.php:1)

Filename: helpers/url_helper.php

Line Number: 541

This is what I did.

I created folder called norwegian in system/language/. I downloaded danish languages since they are very close. And unzipped into that folder.
I changed english to norwegian in the config file.

And the following is my email codes.

Code:
$name = $this->input->post('name');
    $email = $this->input->post('email');
    $message = $this->input->post('message');
    $myemail = '[email protected]';
    $this->load->library('email');
    
    $this->email->from($email.$name);
    $this->email->to($myemail);
    
    $this->email->subject('Email message form MYWEBSITE.com');        
    $this->email->message("sender: ". $name."\r\nSender email: ". $email. "\r\nMessage: " . $message);
    $this->email->send();
        
    $this->session->set_flashdata('subscribe_msg', 'Thanks for your message! You have sent email.');
    redirect('newcontroller/kontakt');


If I take out all the email parts it outputs Thank you message. And as I said before, english with the above code works fine. So I am not sure what is wrong.

Any help will be appreciated.

Thanks in advance.
#2

[eluser]JoostV[/eluser]
The error says some output has been sent to your browser before you use a function in the session class. Usually, this means you either have a whitespace at the beginning or end of an included php file.

Since this all happened after you implemented Norwegian I suggest you have a close look at the Norwegian language files. There is probably a space somewhere before the first <?php or after the last ?>

In all php files, it is the safest to remove the last closing tag ?>. You do not need it, and without it you do not run the risk of having extra whitespace causing errors.
#3

[eluser]shinokada[/eluser]
@JoostV Thanks for your reply.

I seems that I think I need to write it by my self.

I checked all the Norwegian language file and I am not able to find any white space.

I changed all and also only norwegian/email_lang.php with english one to test. And it works.

This means norwegian/email_lang.php looks ok, but somehow it does not work. Anyway I think I know what I need to do now.

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB