CakePHP Email Encoding

My email was not getting sent using the email component in CakePHP. I debugged inside the core and found out that my subject was getting changed to something like,”=?UTF-8?B?V2VsY29tZ…”.

In talking to Larry (core CakePHP team), he educated me that this allows for characters other than the English language to be sent via email (UTF-8 encoding). Even though it apparently was correct, it was still not being received at my personal email or a Yahoo account. Gmail got it, the others didn’t.

The Alternate Email Encoding (English only)

Larry showed me the alternative way to encode that works just fine for English characters. If you are having trouble with receiving these UTF-8 encoded emails, try sending with iso-8859-15 (only English characters). You can try the English encoding using this line of code:

$this->Email->charset = 'iso-8859-15';

This works for English-only applications, but if anyone can offer up a solution as to why Yahoo and Media Temple email accounts are not getting the UTF-8 emails please let me know. It is strange to me that gmail gets it just fine. Until then, I am only planning on sending English emails anyway so there is no issue until I build a multi-lingual application.

Comments

  1. Donnerbeil says

    Hi!
    Did you find any solution for multilanguage support, yet? I have the same problem. Even if I don’t use any non english characters, the mail is empty. I never had this problem with phpmailer. So there is really something to improve in cakephps email component.

  2. pashcan says

    I believe it might have something to do with the SPAM filtering Yahoo is using. I cannot get Cake’s Email component to send to my university’s email account, but gmail is also fine. Kind of annoying! Could you please let us know if you managed to bypass this issue. Thanks!

  3. says

    Not working here, Squirrelmail still has problems with french accents wrote in UTF-8, saved in UTF-8 and sent as UTF-8 by email. :/