Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed libraries/Email.php: UTF8 subject line encoding for Apple Mail (and iOS Mail) / WordWrap for plaintext email #1281

Closed
wants to merge 5 commits into from

Conversation

williamli
Copy link

This patches the Email.php library so that UTF8 subject lines (currently encoded with Q encoding) will show up correctly in Apple Mail / iOS Mail (using B encoding instead).

It also patches the _get_alt_message function so that emails sent from CI will honor the $config['wordwrap'] and $config['wrapchars'] settings.

PS: The word_wrap function used in the master source code does not work well with multibyte characters. It wraps multibyte characters in the middle and breaks multibyte characters making them look like random symbol. This led me to try and disable wordwrap in config only to find out wordwrap wasn't honored in the existing source.

… $config['wrapchars'] settings so that even the plaintext of a multipart email will follow the wordwrap parameters in the email config file.
…ing as Apple Mail (and iOS Mail) have problems loading many of the UTF-8 subject lines when they are encoded with Q encoding (_prep_q_encoding)
$this->_set_header('Subject', $subject);
{
$subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
parent::_set_header('Subject', $subject);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI_Email doesn't have a parent class - this would probably trigger a fatal error.
Also, use tabs for indentation instead of spaces. See the coding style guidelines for more info.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops sorry, I copied the code over from MY_Email class last night where I was doing all the testing.

@williamli
Copy link
Author

I have fixed the error and shortened the code as suggested by @narfbg

@narfbg
Copy link
Contributor

narfbg commented Oct 19, 2012

Both issues resolved and hopefully I won't forget to look at the multibyte characters issue.

@narfbg narfbg closed this Oct 19, 2012
@GDmac
Copy link
Contributor

GDmac commented Oct 21, 2012

if the encoding is known, could use multibyte functions like mb_strcut() or mb_split()

nonchip pushed a commit to nonchip/CodeIgniter that referenced this pull request Jun 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants