-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Conversation
… $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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I have fixed the error and shortened the code as suggested by @narfbg |
Both issues resolved and hopefully I won't forget to look at the multibyte characters issue. |
if the encoding is known, could use multibyte functions like mb_strcut() or mb_split() |
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.