2

This question may sound like stupid but I tried all possible HTML entities and the subject line for the email I send is still not showing the heart on Apple devices (iPhone, iPad, etc).

It may be just the software I use for testing (MaxBulk Mailer, ExactTarget).

I also tried different charset (UTF-8, ascii, etc).

Does anybody know how to make a heart appear as a heart into the subject line of an email for Apple devices?

Snowalker
  • 309
  • 1
  • 7
  • 16

2 Answers2

12

The subject line is part of the email headers. The email headers may only contain ASCII characters. The subject line is not being interpreted as HTML or anything else, it's plain text. You need to embed the character as Unicode character, but you cannot do this since the headers must be in ASCII. To embed any non-ASCII characters in a header, you need to use a MIME Encoded-Word.

See mb_encode_mimeheader, read its examples.

The resulting header will need to look something like this:

Subject: =?utf-8?B?4p2k?=

Which decodes to this in the mail client:

deceze
  • 510,633
  • 85
  • 743
  • 889
  • Thanks man, now we have a heart on iPhone but a square on BlackBerry. Such a frustrating experience with all these devices :( – Snowalker Nov 26 '12 at 18:59
  • A square means it doesn't have a *font* which can display the character. – deceze Nov 26 '12 at 19:14
  • 1
    if is not too much to ask, how did you do to get that code u shared? =?utf-8?B?4p2k?= – Snowalker Nov 26 '12 at 20:05
  • 2
    Well, originally I just sent myself an email... :P But here's a reproduction in actual code: http://3v4l.org/J4Z5S – deceze Nov 26 '12 at 20:10
3

With regards to your question here: you may have picked the wrong heart. Try ♥ instead of ❤. The first one should render on a BlackBerry (and Android 2.2), too, as this test shows. The latter one, however, doesn't.

lukeA
  • 53,097
  • 5
  • 97
  • 100