Example 1 — Decode a Base64 Subject
Decode a header that uses the B (base64) scheme.
<?php
$header = "Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=";
echo iconv_mime_decode($header, 0, "UTF-8"), PHP_EOL; How It Works
- Start with an encoded header. The part inside
=? ... ?=is the encoded word. - Call iconv_mime_decode(). Pass
UTF-8as the output encoding. - The encoded word is decoded. The field name stays as plain text.
- Print the result. You see
Subject: Prüfung Prüfung.

