Obfuscated Email Subject Issue

I'm writing an emailing class for a surveying application i'm coding. Whenever I add the subject variable in to $this->CI->email->subject(); method it obfuscates the subject.

Here is my code:
$this->CI->email->from('[email protected]', 'Me');
        $this->CI->email->reply_to('[email protected]', 'Me');  
        $this->CI->email->to('[email protected]');


The variable $distribution->emailSubject should look like "How was your meal? Let us know and earn 20 points!". But in my subject line of my email client it looks like: "=?utf-8?Q?_How_was_your_meal=3f__Let_us_know_and_earn_20_Points_on_Fare_ X-Sender:"

Has anyone run into a situation like this?

This is how it should be. It tells the mail client receiving the email that the subject text uses utf-8 encoding, as per RFC 1342.

Now when I type in the subject directly in to the email->subject method, the subject line looks fine. Why would it look different if I'm putting in a variable that says the same exact thing?

The subject will always be q-encoded, in case it contains non-ascii characters (7bit), an underscore, an equals sign, or a question mark.

So "How was your meal? Let us know and earn 20 points!" will always be encoded, no matter how you pass it to $this->email->subject().

from the Email library:
function subject($subject)
    $subject = $this->_prep_q_encoding($subject);
    $this->_set_header('Subject', $subject);

I see, but why would it look differently from if I just write it in directly? Is there any way for me to fix my error?

What do you mean by 'write it in directly'?

$this->email->subject('How was your meal?  Let us know and earn 20 points!');
is exactly the same as
$var = 'How was your meal?  Let us know and earn 20 points!';

Correct, but when I use the variable method. The subject line gets printed as: =?utf-8?Q?_How_was_your_meal=3f__Let_us_know_and_earn_20_Points_on_Fare_ X-Sender:

Yes, as it should be. The only thing that puzzles me is the 'X-Sender:' at the end, which should be on the next line.

Where do you get this subject line from? From the header of your mail client? Which mail client?

This is the exact subject line from Apple Mail:
=?utf-8?Q?_How_was_your_meal=3f__Let_us_know_and_earn_20_Points_on_Fare_ X-Sender: [email protected]

(I removed the actual email address in the subject line). If you are interested in me forwarding you the message, just send me a quick email to (my forum username)@gmail.com, that way I can send you all the header information.

Thank you for your help btw.

Sounds more like an issue with your email client. What happens if you send that exact same email to your gmail account?

If I send an email out with that subject line to the mail systems I have here (imap/squirrelmail & exchange 2010/Outlook 2010), both show the header in q-encoding, and display the subject properly.

see if
$this-email->newline  = "\r\n";
will help...

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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