简体   繁体   中英

What HTML entity to use in the email subject line for a heart?

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?

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:

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.

An email subject is plain text, not HTML. I wouldn't rely on email clients showing any kind of HTML within your subject lines.

You can try hardcoding the heart character into the subject by copying and pasting it, but I wouldn't expect great results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM