Search code examples
phpimap

How to decode subject line


I received an email whose subject line is Last Day Today☛ An Additional 32% Off Your Favourite Brands, but when I looked into it's header subject line looks like -

Subject: =?utf-8?Q?Last=20Day=20Today=E2=98=9B=20An=20Additional=2032%=20Off=20Your=20?=
=?utf-8?Q?Favourite=20Brands.?=

If I fetch out value of subject using imap_headerinfo() then how could I decode this value.


Solution

  • You can also try mb_decode_mimeheader(); This might work for you.